From b69eda2e73c0f0db88de740daa20aa057a0a16fa Mon Sep 17 00:00:00 2001 From: Amara Emerson Date: Sun, 9 Feb 2020 10:09:51 -0800 Subject: [PATCH] [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. --- lib/CodeGen/GlobalISel/CallLowering.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/GlobalISel/CallLowering.cpp b/lib/CodeGen/GlobalISel/CallLowering.cpp index 752f26b7638..65b58801366 100644 --- a/lib/CodeGen/GlobalISel/CallLowering.cpp +++ b/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(CalleeV)) { + auto *BC = dyn_cast(CalleeV); + if (BC && BC->getOpcode() == Instruction::BitCast) { if (const auto *F = dyn_cast(BC->getOperand(0))) { Info.Callee = MachineOperand::CreateGA(F, 0); }