Skip to content

Commit d2a5040

Browse files
committed
[InstCombine] Address review comments.
1 parent 60e6592 commit d2a5040

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1868,7 +1868,9 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
18681868
if (Instruction *Res = foldBinOpOfSelectAndCastOfSelectCondition(I))
18691869
return Res;
18701870

1871-
if (Changed) {
1871+
// Re-enqueue add instruction with PHI operands if we infer new nuw/nsw flags.
1872+
if (Changed &&
1873+
(isa<PHINode>(I.getOperand(0)) || isa<PHINode>(I.getOperand(1)))) {
18721874
for (User *U : I.users()) {
18731875
if (auto *PHI = dyn_cast<PHINode>(U))
18741876
Worklist.pushUsersToWorkList(*PHI);

0 commit comments

Comments
 (0)