From 462a67fadd8bec3fe86bef0b045649f65cffaedd Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 2 Nov 2019 00:11:48 -0700 Subject: [PATCH] [IR] Avoid use of PointerType::getElementType() in one of the CallBrInst constructors. We already have the FunctionType we can call getReturnType on. I think this was due to a bad rebase of the CallBr patch while it was in development when CallInst and InvokeInst were updated. --- llvm/include/llvm/IR/Instructions.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h index 2913a820c4c0..e9d3d2169be0 100644 --- a/llvm/include/llvm/IR/Instructions.h +++ b/llvm/include/llvm/IR/Instructions.h @@ -4142,13 +4142,9 @@ CallBrInst::CallBrInst(FunctionType *Ty, Value *Func, BasicBlock *DefaultDest, ArrayRef Args, ArrayRef Bundles, int NumOperands, const Twine &NameStr, BasicBlock *InsertAtEnd) - : CallBase( - cast( - cast(Func->getType())->getElementType()) - ->getReturnType(), - Instruction::CallBr, - OperandTraits::op_end(this) - NumOperands, NumOperands, - InsertAtEnd) { + : CallBase(Ty->getReturnType(), Instruction::CallBr, + OperandTraits::op_end(this) - NumOperands, NumOperands, + InsertAtEnd) { init(Ty, Func, DefaultDest, IndirectDests, Args, Bundles, NameStr); }