[llvm] 21c9d9a - [GlobalISel][CallLowering] Tighten constantexpr check for callee.

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 9 23:00:49 PST 2020


Author: Amara Emerson
Date: 2020-02-09T22:59:48-08:00
New Revision: 21c9d9ad43f07c07a127bc6f29f13f62e831ab11

URL: https://github.com/llvm/llvm-project/commit/21c9d9ad43f07c07a127bc6f29f13f62e831ab11
DIFF: https://github.com/llvm/llvm-project/commit/21c9d9ad43f07c07a127bc6f29f13f62e831ab11.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/CodeGen/GlobalISel/CallLowering.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 752f26b76382..65b588013667 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);
       }


        


More information about the llvm-commits mailing list