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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 01:49:57 PST 2024


================
@@ -1868,6 +1868,13 @@ Instruction *InstCombinerImpl::visitAdd(BinaryOperator &I) {
   if (Instruction *Res = foldBinOpOfSelectAndCastOfSelectCondition(I))
     return Res;
 
+  if (Changed) {
----------------
nikic wrote:

We're only interested in recurrence phis here, right? So can we check first if an add operand is a phi, and then whether it is in the user list? That way we can avoid the full users scan in most cases.

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


More information about the llvm-commits mailing list