summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-05-19 06:51:32 +0000
committerChris Lattner <sabre@nondot.org>2007-05-19 06:51:32 +0000
commita655a157a0a8da055d441522ffab105990a1d80e (patch)
tree30a297260ee6ade5c23f747a4fe61ffebefa43ee /llvm/lib/Transforms/Scalar/InstructionCombining.cpp
parentfaa31904e4466e4ef5fc7e431229391351e4a6c1 (diff)
downloadbcm5719-llvm-a655a157a0a8da055d441522ffab105990a1d80e.tar.gz
bcm5719-llvm-a655a157a0a8da055d441522ffab105990a1d80e.zip
Fix Transforms/InstCombine/2007-05-18-CastFoldBug.ll, a bug that devastates
objc code due to the way the FE lowers objc message sends. llvm-svn: 37256
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InstructionCombining.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 08905576d22..db105adf7ff 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7773,6 +7773,14 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
const FunctionType *FT = Callee->getFunctionType();
const Type *OldRetTy = Caller->getType();
+ const FunctionType *ActualFT =
+ cast<FunctionType>(cast<PointerType>(CE->getType())->getElementType());
+
+ // If the parameter attributes don't match up, don't do the xform. We don't
+ // want to lose an sret attribute or something.
+ if (FT->getParamAttrs() != ActualFT->getParamAttrs())
+ return false;
+
// Check to see if we are changing the return type...
if (OldRetTy != FT->getReturnType()) {
if (Callee->isDeclaration() && !Caller->use_empty() &&
OpenPOWER on IntegriCloud