aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorAmara Emerson <aemerson@apple.com>2020-02-09 10:09:51 -0800
committerAmara Emerson <aemerson@apple.com>2020-02-09 22:59:48 -0800
commit21c9d9ad43f07c07a127bc6f29f13f62e831ab11 (patch)
treead79b752243bf739ea575f133a7017e8c00e5b4e /llvm/lib
parent8155439331ac8f85be54adbd053c100567927d7c (diff)
downloadllvm-21c9d9ad43f07c07a127bc6f29f13f62e831ab11.zip
llvm-21c9d9ad43f07c07a127bc6f29f13f62e831ab11.tar.gz
llvm-21c9d9ad43f07c07a127bc6f29f13f62e831ab11.tar.bz2
[GlobalISel][CallLowering] Tighten constantexpr check for callee.
I'm not sure there's a test case for this, but it's better to be safe.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/GlobalISel/CallLowering.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 752f26b..65b5880 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -56,7 +56,8 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, ImmutableCallSite CS,
// Try looking through a bitcast from one function type to another.
// Commonly happens with calls to objc_msgSend().
const Value *CalleeV = CS.getCalledValue();
- if (auto *BC = dyn_cast<ConstantExpr>(CalleeV)) {
+ auto *BC = dyn_cast<ConstantExpr>(CalleeV);
+ if (BC && BC->getOpcode() == Instruction::BitCast) {
if (const auto *F = dyn_cast<Function>(BC->getOperand(0))) {
Info.Callee = MachineOperand::CreateGA(F, 0);
}