Skip to content

Commit b8d8db3

Browse files
committed
[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
1 parent c48712b commit b8d8db3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3902,8 +3902,11 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
39023902
return replaceInstUsesWith(*II, ConstantPointerNull::get(PT));
39033903

39043904
// isKnownNonNull -> nonnull attribute
3905-
if (isKnownNonZero(DerivedPtr, DL, 0, &AC, II, &DT))
3905+
if (!II->hasRetAttr(Attribute::NonNull) &&
3906+
isKnownNonZero(DerivedPtr, DL, 0, &AC, II, &DT)) {
39063907
II->addAttribute(AttributeList::ReturnIndex, Attribute::NonNull);
3908+
return II;
3909+
}
39073910
}
39083911

39093912
// TODO: bitcast(relocate(p)) -> relocate(bitcast(p))

0 commit comments

Comments
 (0)