1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

[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.
This commit is contained in:
Amara Emerson 2020-02-09 10:09:51 -08:00
parent bf5760c5ab
commit b69eda2e73

View File

@ -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);
}