diff options
author | Jim Grosbach <grosbach@apple.com> | 2012-02-03 00:00:55 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2012-02-03 00:00:55 +0000 |
commit | f374486659822e93054363bef05e781acee16f3b (patch) | |
tree | b9264c42a9a32dafc6f77d8a7df9732d512f3b5e /lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | d5917f0b4d8f87985bfdf130c269e1929d0085d1 (diff) | |
download | llvm-f374486659822e93054363bef05e781acee16f3b.tar.gz llvm-f374486659822e93054363bef05e781acee16f3b.tar.bz2 llvm-f374486659822e93054363bef05e781acee16f3b.tar.xz |
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
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCalls.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCalls.cpp b/lib/Transforms/InstCombine/InstCombineCalls.cpp index a87fbbd989..26e0a5528c 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<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() && |