[llvm-commits] [llvm] r149648 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp

Jim Grosbach grosbach at apple.com
Thu Feb 2 16:00:55 PST 2012


Author: grosbach
Date: Thu Feb  2 18:00:55 2012
New Revision: 149648

URL: http://llvm.org/viewvc/llvm-project?rev=149648&view=rev
Log:
Restrict InstCombine from converting varargs to or from fixed args.

More targetted fix replacing d0e277d272d517ca1cda368267d199f0da7cad95.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=149648&r1=149647&r2=149648&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Thu Feb  2 18:00:55 2012
@@ -1104,6 +1104,13 @@
     PointerType *APTy = cast<PointerType>(CS.getCalledValue()->getType());
     if (FT->isVarArg()!=cast<FunctionType>(APTy->getElementType())->isVarArg())
       return false;
+
+    // If both the callee and the cast type are varargs, we still have to make
+    // sure the number of fixed parameters are the same or we have the same
+    // ABI issues as if we introduce a varargs call.
+    if (FT->getNumParams() !=
+        cast<FunctionType>(APTy->getElementType())->getNumParams())
+      return false;
   }
       
   if (FT->getNumParams() < NumActualArgs && FT->isVarArg() &&





More information about the llvm-commits mailing list