diff options
author | Edwin Török <edwintorok@gmail.com> | 2009-09-24 18:33:42 +0000 |
---|---|---|
committer | Edwin Török <edwintorok@gmail.com> | 2009-09-24 18:33:42 +0000 |
commit | 129b2d16553e46db3b5675b63e777931e2ea4cec (patch) | |
tree | a1bfd4d5818635b817206fe5ee991673baab2901 /lib/Transforms | |
parent | b493c9735a034856258c992d967b523d0effa7ce (diff) | |
download | external_llvm-129b2d16553e46db3b5675b63e777931e2ea4cec.zip external_llvm-129b2d16553e46db3b5675b63e777931e2ea4cec.tar.gz external_llvm-129b2d16553e46db3b5675b63e777931e2ea4cec.tar.bz2 |
Constant propagating byval pointer is safe if function is readonly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82700 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/IPConstantPropagation.cpp | 4 | ||||
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp index 95c3f4e..7b0e9c7 100644 --- a/lib/Transforms/IPO/IPConstantPropagation.cpp +++ b/lib/Transforms/IPO/IPConstantPropagation.cpp @@ -130,8 +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() || - (AI->hasByValAttr() && isa<PointerType>(AI->getType()))) + if (ArgumentConstants[i].second || AI->use_empty() || + (AI->hasByValAttr() && !F.onlyReadsMemory())) continue; Value *V = ArgumentConstants[i].first; diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index bf9ec0e..ad4bcc9 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1267,7 +1267,7 @@ 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())) { + if (AI->hasByValAttr() && !F->onlyReadsMemory()) { IV.markOverdefined(); continue; } |