[PATCH] D69217: [ConstantRange] makeGuaranteedNoWrapRegion(): `shl` support

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 20 12:04:41 PDT 2019


nikic added inline comments.


================
Comment at: llvm/unittests/IR/ConstantRangeTest.cpp:1599
             ConstantRange::makeGuaranteedNoWrapRegion(BinOp, CR2, NoWrapKind);
         ForeachNumInConstantRange(CR1, [&](const APInt &N1) {
           bool NoOverflow = true;
----------------
nikic wrote:
> So, I wrote this test, but I can't say I understand why it does what it does... Enumerating over all ranges CR1 seems to be entirely unnecessary, it would be sufficient to just iterate over all N1 in the full range to get the same coverage, and save us a whole lot of unnecessary iterations.
> 
> That should allow us to run this test with a larger bit width, in which case you could just drop the MakeGuaranteedNoWrapRegionShl(Un)signedSingleValue tests entirely, as they are special cases of what is checked here (just with a larger bit width).
As it's unrelated to this revision, I've made this change in rL375369. Now testing 5 bits, which is good enough I think.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69217





More information about the llvm-commits mailing list