[PATCH] D21010: Replace the implementation of ConstantRange::binaryAnd.

Nick Lewycky via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 5 20:29:24 PDT 2016


nicholas created this revision.
nicholas added reviewers: llvm-commits, regehr, sanjoy, majnemer.

The idea is to find two representatives out of the two ranges which will (by construction) form the UMin of the post-binaryAnd range when and'd, and do it again for the UMax.

For wrapped ranges, we break the range in two non-wrapping ConstantRanges, a low part and a high part, and use the algorithm above to pick representatives between the LHS ranges and RHS ranges.

I'm quite confident that the resulting range includes all possible results, and that the result is the smallest to do so except maybe for wrapping ranges.

I'd greatly appreciate any help simplifying this algorithm, both in implementation and in explanation (the details in the comments). As it stands I think this is too messy to commit and I'm hopeful that the review discussion will lead to significant improvements.

http://reviews.llvm.org/D21010

Files:
  lib/IR/ConstantRange.cpp
  unittests/IR/ConstantRangeTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21010.59687.patch
Type: text/x-patch
Size: 10478 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160606/f144f87f/attachment.bin>


More information about the llvm-commits mailing list