From: Jim Grosbach Date: Fri, 3 Feb 2012 00:00:55 +0000 (+0000) Subject: Restrict InstCombine from converting varargs to or from fixed args. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f374486659822e93054363bef05e781acee16f3b;p=oota-llvm.git Restrict InstCombine from converting varargs to or from fixed args. More targetted fix replacing d0e277d272d517ca1cda368267d199f0da7cad95. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149648 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index a87fbbd9895..26e0a5528c3 100644 --- a/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -1104,6 +1104,13 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) { PointerType *APTy = cast(CS.getCalledValue()->getType()); if (FT->isVarArg()!=cast(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(APTy->getElementType())->getNumParams()) + return false; } if (FT->getNumParams() < NumActualArgs && FT->isVarArg() &&