[PATCH] D102267: [SCEV] Apply guards to max with non-unitary steps.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 12:13:47 PDT 2021


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:9269
+      assert(MaxInt.ule(getUnsignedRangeMax(Exact)) &&
+             "applying loop guards pessimized the found maximum");
+      Max = getConstant(MaxInt);
----------------
Is there any particular reason to believe that this assertion can't be hit? The unit step case takes the minimum and has a test for this (`@guard_pessimizes_analysis`). Or is the assert here so we can find a test case?

On a related note, I wonder if we shouldn't be limiting the guard insertion to comparisons against constants. That case should be non-pessimizing, and at least none of the existing tests benefit from non-constant guards.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102267



More information about the llvm-commits mailing list