[PATCH] D59563: [ValueTracking] Compute range for abs without nsw

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 14:32:32 PDT 2019


nikic marked an inline comment as done.
nikic added inline comments.


================
Comment at: llvm/test/Transforms/InstSimplify/icmp-abs-nabs.ll:158
   %abs = select i1 %cmp, i32 %negx, i32 %x
   %r = icmp ult i32 %abs, 2147483649
   ret i1 %r
----------------
lebedev.ri wrote:
> Hm, after thinking about it a bit more, i think the test coverage could be improved.
> In reality, this test only shows that we end up folding this pattern to `true`.
> But what are the thresholds for that opt to happen?
> I.e. i think you'd want to add two more test cases here, with `2147483649+1` and `2147483649-1` constants.
The test directly below this one checks the <2147483648 case, which does not fold. So if <2147483648 does not fold but <2147483649 does, this has to be the upper boundary of the range. (It does not check the lower boundary, but as it's zero and >= 0 in unsigned domain is tautological we can't do a direct check for it.)


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59563/new/

https://reviews.llvm.org/D59563





More information about the llvm-commits mailing list