[llvm] r346698 - [GC][InstCombine] Fix a potential iteration issue
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 12 12:00:53 PST 2018
Author: reames
Date: Mon Nov 12 12:00:53 2018
New Revision: 346698
URL: http://llvm.org/viewvc/llvm-project?rev=346698&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=346698&r1=346697&r2=346698&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Mon Nov 12 12:00:53 2018
@@ -3902,8 +3902,11 @@ Instruction *InstCombiner::visitCallInst
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))
More information about the llvm-commits
mailing list