[PATCH] D48853: [SCEV] Add zext(C + x + ...) -> D + zext(C-D + x + ...)<nuw> transform

Roman Tereshin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 2 16:12:47 PDT 2018


rtereshin added a comment.

In https://reviews.llvm.org/D48853#1150253, @efriedma wrote:

> Could you use ScalarEvolution::GetMinTrailingZeros instead of calling computeKnownBits directly?


I don't think so. I need to know the maximum unsigned number I can safely subtract from an expression (w/o wrapping). Number of trailing zeros is of no use for this, I think.
`GetMinTrailingOnes`, if it existed, wouldn't help much either: let's say, the expression is `x * 8 + 6`. The number of trailing ones here is 0, though we can safely subtract any number from 0 to 6 (inclusive) (KnownBits are XXXX X110).


Repository:
  rL LLVM

https://reviews.llvm.org/D48853





More information about the llvm-commits mailing list