[llvm] [InstCombine] Re-queue users of phi when nsw/nuw flags of add are inferred (PR #113933)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 28 09:24:27 PDT 2024


================
@@ -1868,6 +1868,13 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
   if (Instruction *Res = foldBinOpOfSelectAndCastOfSelectCondition(I))
     return Res;
 
+  if (Changed) {
+    for (User *U : I.users()) {
+      if (auto *PHI = dyn_cast<PHINode>(U))
+        Worklist.pushUsersToWorkList(*PHI);
+    }
+  }
----------------
goldsteinn wrote:

This obviously has a positive effect, but I don't quite understand why this isn't already handled by `pushUsersToWorkList` in the normal InstCombine loop.

https://github.com/llvm/llvm-project/pull/113933


More information about the llvm-commits mailing list