[llvm-commits] [llvm] r107767 - /llvm/trunk/lib/Analysis/ConstantFolding.cpp

Gabor Greif ggreif at gmail.com
Wed Jul 7 03:34:04 PDT 2010


Author: ggreif
Date: Wed Jul  7 05:34:03 2010
New Revision: 107767

URL: http://llvm.org/viewvc/llvm-project?rev=107767&view=rev
Log:
conditionalize by CallInst::ArgOffset

Modified:
    llvm/trunk/lib/Analysis/ConstantFolding.cpp

Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=107767&r1=107766&r2=107767&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Wed Jul  7 05:34:03 2010
@@ -772,9 +772,9 @@
   case Instruction::ICmp:
   case Instruction::FCmp: assert(0 && "Invalid for compares");
   case Instruction::Call:
-    if (Function *F = dyn_cast<Function>(Ops[0]))
+    if (Function *F = dyn_cast<Function>(Ops[CallInst::ArgOffset ? 0:NumOps-1]))
       if (canConstantFoldCallTo(F))
-        return ConstantFoldCall(F, Ops+1, NumOps-1);
+        return ConstantFoldCall(F, Ops+CallInst::ArgOffset, NumOps-1);
     return 0;
   case Instruction::PtrToInt:
     // If the input is a inttoptr, eliminate the pair.  This requires knowing





More information about the llvm-commits mailing list