[PATCH] D48853: [SCEV] Add [zs]ext{C, +, x} -> (D + [zs]ext{C-D, +, x})<nuw><nsw> transform

Michael Zolotukhin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 19 17:55:02 PDT 2018


mzolotukhin accepted this revision.
mzolotukhin added a comment.
This revision is now accepted and ready to land.

I've looked at the patch one more time more carefully, it looks good to me!

Thanks,
Michael



================
Comment at: lib/Analysis/ScalarEvolution.cpp:1570-1579
+  // ConstantRange is unable to prove that it's possible to transform
+  // an expression like (5 + (4 * X)) to (1 + (4 + (4 * X))) w/o underflowing:
+  //
+  // |  Expression   |     ConstantRange      |       KnownBits       |
+  // |---------------|------------------------|-----------------------|
+  // | i8      4 * X | [L: 0, U: 253)         | XXXX XX00             |
+  // |               |   => Min: 0, Max: 252  |   => Min: 0, Max: 252 |
----------------
Maybe  move that comment to the explanation in the commit message too? It's not obvious what `ConstantRange` has to with the code around (I understand where it comes from, but I have the full context of the patch now - for someone browsing through the code later it won't be clear why we mention `ConstantRange` here).


Repository:
  rL LLVM

https://reviews.llvm.org/D48853





More information about the llvm-commits mailing list