aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTanya Lattner <tonic@nondot.org>2009-10-01 15:12:41 +0000
committerTanya Lattner <tonic@nondot.org>2009-10-01 15:12:41 +0000
commite07cc230d9f5997fa5faa23fd9203a8429175325 (patch)
tree6af7379d076cab1eda86209da364e86ce0b6597d /lib
parentf2641fb4d0090497b8a757581718c218d33f64f3 (diff)
Merge from mainline (reg).
Don't constant propagate byval pointers, since they are not really pointers, but rather structs passed by value. This fixes PR5038. git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_26@83200 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp3
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp4
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index bb2448610f..95c3f4e354 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -130,7 +130,8 @@ bool IPCP::PropagateConstantsIntoArguments(Function &F) {
Function::arg_iterator AI = F.arg_begin();
for (unsigned i = 0, e = ArgumentConstants.size(); i != e; ++i, ++AI) {
// Do we have a constant argument?
- if (ArgumentConstants[i].second || AI->use_empty())
+ if (ArgumentConstants[i].second || AI->use_empty() ||
+ (AI->hasByValAttr() && isa<PointerType>(AI->getType())))
continue;
Value *V = ArgumentConstants[i].first;
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 4a9675aa02..5b948e3b22 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -1263,6 +1263,10 @@ CallOverdefined:
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
AI != E; ++AI, ++CAI) {
LatticeVal &IV = ValueState[AI];
+ if (AI->hasByValAttr() && isa<PointerType>(AI->getType())) {
+ IV.markOverdefined();
+ continue;
+ }
if (!IV.isOverdefined())
mergeInValue(IV, AI, getValueState(*CAI));
}