summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2012-02-03 00:00:55 +0000
committerJim Grosbach <grosbach@apple.com>2012-02-03 00:00:55 +0000
commite84ae7bfa09685224279f5dc59860b70472d3cc6 (patch)
treee26d4a69089d544885c1cf5ee880080e2d74534e /llvm/lib
parent0ab54184d73690808854b4e6d84d11c9edb0045f (diff)
downloadbcm5719-llvm-e84ae7bfa09685224279f5dc59860b70472d3cc6.tar.gz
bcm5719-llvm-e84ae7bfa09685224279f5dc59860b70472d3cc6.zip
Restrict InstCombine from converting varargs to or from fixed args.
More targetted fix replacing d0e277d272d517ca1cda368267d199f0da7cad95. llvm-svn: 149648
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index a87fbbd9895..26e0a5528c3 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/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() &&
OpenPOWER on IntegriCloud