diff options
author | Philip Reames <listmail@philipreames.com> | 2018-11-12 20:00:53 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2018-11-12 20:00:53 +0000 |
commit | b8d8db30ea54a9394e5387410d98fcaae6cd7336 (patch) | |
tree | 3bb260c96e7c83a65f534412d752e1829225c5ae /llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | |
parent | c48712b341f328c6095d50bde1947cc523b04014 (diff) | |
download | bcm5719-llvm-b8d8db30ea54a9394e5387410d98fcaae6cd7336.tar.gz bcm5719-llvm-b8d8db30ea54a9394e5387410d98fcaae6cd7336.zip |
[GC][InstCombine] Fix a potential iteration issue
Noticed via inspection. Appears to be largely innocious in practice, but slight code change could have resulted in either visit order dependent missed optimizations or infinite loops. May be a minor compile time problem today.
llvm-svn: 346698
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index c1872a1c9ce..fae47ec93b9 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -3902,8 +3902,11 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) { return replaceInstUsesWith(*II, ConstantPointerNull::get(PT)); // isKnownNonNull -> nonnull attribute - if (isKnownNonZero(DerivedPtr, DL, 0, &AC, II, &DT)) + if (!II->hasRetAttr(Attribute::NonNull) && + isKnownNonZero(DerivedPtr, DL, 0, &AC, II, &DT)) { II->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull); + return II; + } } // TODO: bitcast(relocate(p)) -> relocate(bitcast(p)) |