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

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 1 11:47:40 PDT 2018


kparzysz marked 4 inline comments as done.
kparzysz added inline comments.


================
Comment at: unittests/ADT/APIntTest.cpp:2368
+
+    if (Solution == 0) {
+      EXPECT_EQ(C & Mask, 0);
----------------
sanjoy wrote:
> Why do we need this special case?
We don't really.  Removed.


================
Comment at: unittests/ADT/APIntTest.cpp:2384
+      int64_t OverX = OverflowBits(VX, Width);
+      return (VX & Mask) == 0 || OverX != Over0;
+    };
----------------
sanjoy wrote:
> I don't quite understand this.  Don't you need to check that the overflow bits are different from when the equation is evaluated at `X-1` (and not from when the equation is evaluated at `0`, which is what it looks like you're doing here)?
The overflow bits should not change between 0 and X-1 inclusive.  We're looking for the first X such that they do change, or that the value is 0 (whichever happens first).


Repository:
  rL LLVM

https://reviews.llvm.org/D48283





More information about the llvm-commits mailing list