From 30a94e3b4203cee64db0edd997780bbe4ad0acdc Mon Sep 17 00:00:00 2001 From: Torok Edwin Date: Thu, 24 Sep 2009 09:47:18 +0000 Subject: 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 --- lib/Transforms/IPO/IPConstantPropagation.cpp | 3 ++- lib/Transforms/Scalar/SCCP.cpp | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/Transforms') 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(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(AI->getType())) { + IV.markOverdefined(); + continue; + } if (!IV.isOverdefined()) mergeInValue(IV, AI, getValueState(*CAI)); } -- cgit v1.2.3-18-g5258