[PATCH] D48283: [SCEV] Properly solve quadratic equations
Krzysztof Parzyszek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 18 13:37:24 PDT 2018
kparzysz added a comment.
Well, for one 2/2 seems to be -1...
Code:
APInt TT, UU;
APInt::udivrem(APInt(72, 2), APInt(72, 2), TT, UU);
dbgs() << "TT=" << TT << '\n';
Output:
TT=-1
This is because we handle the special case of LHS==RHS via "Quotient=1", which sets the bitwidth to 1...
But there is also something else going on with this test. The code in getNumIterationsInRange assumes that it's the upper bound of the range that will be crossed, while this case crosses the lower bound. We should really solve for both and eliminate the wrong solution (the one for which the assertion fails).
Repository:
rL LLVM
https://reviews.llvm.org/D48283
More information about the llvm-commits
mailing list