aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2007-05-22 05:38:40 +0000
committerTanya Lattner <tonic@nondot.org>2007-05-22 05:38:40 +0000
commitfde99dce90e424b1c8c9485bf3973e1bdf7ace6d (patch)
tree183086ca45fce455926875e7ec147fe216014c17
parent4a1c816238a377eb78ade05d7379ad0acacf8820 (diff)
Merge from mainline
git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_20@37276 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index e7a1617fd6..cb80cdb74f 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7773,6 +7773,14 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
if (Callee->isDeclaration() && !Caller->use_empty() &&
// Conversion is ok if changing from pointer to int of same size.
!(isa<PointerType>(FT->getReturnType()) &&
+ 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;
+
TD->getIntPtrType() == OldRetTy))
return false; // Cannot transform this return value.