[llvm] 462a67f - [IR] Avoid use of PointerType::getElementType() in one of the CallBrInst constructors.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 2 01:40:02 PDT 2019
Author: Craig Topper
Date: 2019-11-02T01:39:21-07:00
New Revision: 462a67fadd8bec3fe86bef0b045649f65cffaedd
URL: https://github.com/llvm/llvm-project/commit/462a67fadd8bec3fe86bef0b045649f65cffaedd
DIFF: https://github.com/llvm/llvm-project/commit/462a67fadd8bec3fe86bef0b045649f65cffaedd.diff
LOG: [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.
Added:
Modified:
llvm/include/llvm/IR/Instructions.h
Removed:
################################################################################
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<Value *> Args,
ArrayRef<OperandBundleDef> Bundles, int NumOperands,
const Twine &NameStr, BasicBlock *InsertAtEnd)
- : CallBase(
- cast<FunctionType>(
- cast<PointerType>(Func->getType())->getElementType())
- ->getReturnType(),
- Instruction::CallBr,
- OperandTraits<CallBase>::op_end(this) - NumOperands, NumOperands,
- InsertAtEnd) {
+ : CallBase(Ty->getReturnType(), Instruction::CallBr,
+ OperandTraits<CallBase>::op_end(this) - NumOperands, NumOperands,
+ InsertAtEnd) {
init(Ty, Func, DefaultDest, IndirectDests, Args, Bundles, NameStr);
}
More information about the llvm-commits
mailing list