[PATCH] D48283: [SCEV] Properly solve quadratic equations
Krzysztof Parzyszek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 18 08:23:58 PDT 2018
kparzysz marked 5 inline comments as done.
kparzysz added inline comments.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:8285
+ // In i1, 1 is the same as -1, so sign-extending (i1 1) would actually
+ // produce -1 in the larger type.
+ N = N.zext(NewWidth);
----------------
efriedma wrote:
> The algorithm should still work even if you treat "i1 true" as -1, I think. Actually, you end up solving the exact same equation, because of the `A.isNegative()` check.
You're right. The check for `A.isNegative()` was added later.
================
Comment at: lib/Analysis/ScalarEvolution.cpp:10641
+ return R;
return SE.getCouldNotCompute(); // Something strange happened
}
----------------
efriedma wrote:
> Please make sure we have a testcase that hits this "getCouldNotCompute".
This shouldn't really happen. I've changed it to an assert.
Repository:
rL LLVM
https://reviews.llvm.org/D48283
More information about the llvm-commits
mailing list