summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
diff options
context:
space:
mode:
authorXin Tong <trent.xin.tong@gmail.com>2018-04-23 20:09:08 +0000
committerXin Tong <trent.xin.tong@gmail.com>2018-04-23 20:09:08 +0000
commit8edff279236dcea52c7a716b09562e2f47fe093a (patch)
tree1da924c12a302972313943e7fd420871d4e62d6e /llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
parent1a2ce572bf61bd7139b92e2d8e2dbabfdfa52aa2 (diff)
downloadbcm5719-llvm-8edff279236dcea52c7a716b09562e2f47fe093a.tar.gz
bcm5719-llvm-8edff279236dcea52c7a716b09562e2f47fe093a.zip
[CallSiteSplit] Make sure we remove nonnull if the parameter turns out to be a constant.
Summary: We do not need nonull attribute if we know an argument is going to be constant. Reviewers: junbuml, davide, fhahn Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D45608 llvm-svn: 330641
Diffstat (limited to 'llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
index ce1c83d29aa..dac52a6e3b7 100644
--- a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
+++ b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp
@@ -97,8 +97,12 @@ static void setConstantInArgument(CallSite CS, Value *Op,
Constant *ConstValue) {
unsigned ArgNo = 0;
for (auto &I : CS.args()) {
- if (&*I == Op)
+ if (&*I == Op) {
+ // It is possible we have already added the non-null attribute to the
+ // parameter by using an earlier constraining condition.
+ CS.removeParamAttr(ArgNo, Attribute::NonNull);
CS.setArgument(ArgNo, ConstValue);
+ }
++ArgNo;
}
}
OpenPOWER on IntegriCloud