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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 20 09:29:16 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;
----------------
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).


================
Comment at: llvm/unittests/IR/ConstantRangeTest.cpp:1924
+  }
+}
+
----------------
Why is this test structurally different from the previous one?


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