diff options
author | Torok Edwin <edwintorok@gmail.com> | 2009-09-24 09:47:18 +0000 |
---|---|---|
committer | Torok Edwin <edwintorok@gmail.com> | 2009-09-24 09:47:18 +0000 |
commit | 30a94e3b4203cee64db0edd997780bbe4ad0acdc (patch) | |
tree | 933afcf9967cb4b73c1c5fb731b12a6dfe16c0fd /lib/Transforms | |
parent | 48f7ce88a6040c12d4c7d0a5bd208cf1e0bda9d1 (diff) |
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/trunk@82689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/IPConstantPropagation.cpp | 3 | ||||
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 4 |
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 f0b5d7702e..bf9ec0e4ad 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/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)); } |