[PATCH] D48283: [SCEV] Properly solve quadratic equations

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 20 14:46:31 PDT 2018


kparzysz added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:10710
+      return UpperValid ? SE.getConstant(SU.getValue())
+                        : SE.getConstant(SL.getValue());
+
----------------
kparzysz wrote:
> efriedma wrote:
> > I'm not convinced this is correct: why is the "valid" solution guaranteed to be smaller?
> Are you referring to line 10720?  Because it's the number of iterations. Both solutions are positive and both are validated as leaving the range, so the smaller one will happen first.
In this line, either UpperValid or LowerValid are true, but not both.  If UpperValid is false, then the lower solution is.


Repository:
  rL LLVM

https://reviews.llvm.org/D48283





More information about the llvm-commits mailing list