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

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 11:21:53 PDT 2018


kparzysz added inline comments.


================
Comment at: lib/Analysis/ScalarEvolution.cpp:8270
+/// the quadratic chrec {L,+,M,+,N} equals 0 or wraps around 2^BW in the
+/// unsigned modulo 2^BW arithmetic. A signed overflow is ignored (it would
+/// correspond to wrapping around 2^(BW-1)).
----------------
efriedma wrote:
> "A signed overflow is ignored" contradicts the implementation; you're treating the coefficients as signed values (by sign-extending them).
I'm solving q(x) = k * 2^BW.  The reason why I'm sign-extending the values is to keep the behavior around 0 the same.  I am avoiding any overflows in the calculations and I simulate the unsigned one via "2kR".


Repository:
  rL LLVM

https://reviews.llvm.org/D48283





More information about the llvm-commits mailing list