summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorTorok Edwin <edwintorok@gmail.com>2009-09-24 09:47:18 +0000
committerTorok Edwin <edwintorok@gmail.com>2009-09-24 09:47:18 +0000
commitf95a450ef9d6d106af171c4f34b2427c32dfc91f (patch)
treeb024e29c898bcaa3c6310ffc86596cd5016659ab /llvm/lib/Transforms
parenta5840dbcb55dd6757916446b442a97f12ff154ab (diff)
downloadbcm5719-llvm-f95a450ef9d6d106af171c4f34b2427c32dfc91f.tar.gz
bcm5719-llvm-f95a450ef9d6d106af171c4f34b2427c32dfc91f.zip
Don't constant propagate byval pointers, since they are not really pointers, but
rather structs passed by value. This fixes PR5038. llvm-svn: 82689
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/IPConstantPropagation.cpp3
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp4
2 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp b/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
index bb2448610f2..95c3f4e3548 100644
--- a/llvm/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/llvm/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/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index f0b5d7702e3..bf9ec0e4adf 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -1267,6 +1267,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));
}
OpenPOWER on IntegriCloud