[PATCH] D145230: [ScalarEvolution] Apply loop guards against min/max for its arguments

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 5 21:31:56 PST 2023


mkazantsev added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15138
+      if (isa<SCEVUMaxExpr>(RewrittenLHS))
+        AddMinMaxRewrites(RewrittenLHS, RHSMinusOne);
+      else
----------------
You should set `RewrittenRHS` if it happens.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:15140
+      else
+        RewrittenRHS = getUMinExpr(RewrittenLHS, RHSMinusOne);
       break;
----------------
Can we just always call `AddMinMaxRewrites` and, if it's not min or max, just to the trivial thing?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145230/new/

https://reviews.llvm.org/D145230



More information about the llvm-commits mailing list