summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/ConstantRange.cpp
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-04-12 19:36:47 +0000
committerNikita Popov <nikita.ppv@gmail.com>2019-04-12 19:36:47 +0000
commit3dc7c7ca3115ba9294f72074fdea0bf9bf6f6b60 (patch)
treef48a378bc632c0c0d61b0a91f904602b3c0cb19b /llvm/lib/IR/ConstantRange.cpp
parent2312a06c87207d28c83707db019b4053ceea9bae (diff)
downloadbcm5719-llvm-3dc7c7ca3115ba9294f72074fdea0bf9bf6f6b60.tar.gz
bcm5719-llvm-3dc7c7ca3115ba9294f72074fdea0bf9bf6f6b60.zip
[ConstantRange] Clarify makeGuaranteedNoWrapRegion() guarantees; NFC
makeGuaranteedNoWrapRegion() is actually makeExactNoWrapRegion() as long as only one of NUW or NSW is specified. This is not obvious from the current documentation, and some code seems to think that it is only exact for single-element ranges. Clarify docs and add tests to be more confident this really holds. There are currently no users of makeGuaranteedNoWrapRegion() that pass both NUW and NSW. I think it would be best to drop support for this entirely and then rename the function to makeExactNoWrapRegion(). Knowing that the no-wrap region is exact is useful, because we can backwards-constrain values. What I have in mind in particular is that LVI should be able to constrain values on edges where the with.overflow overflow flag is false. Differential Revision: https://reviews.llvm.org/D60598 llvm-svn: 358305
Diffstat (limited to 'llvm/lib/IR/ConstantRange.cpp')
-rw-r--r--llvm/lib/IR/ConstantRange.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp
index 35c2b0e2e2c..fe67059a892 100644
--- a/llvm/lib/IR/ConstantRange.cpp
+++ b/llvm/lib/IR/ConstantRange.cpp
@@ -869,8 +869,7 @@ ConstantRange::add(const ConstantRange &Other) const {
ConstantRange ConstantRange::addWithNoSignedWrap(const APInt &Other) const {
// Calculate the subset of this range such that "X + Other" is
// guaranteed not to wrap (overflow) for all X in this subset.
- // makeGuaranteedNoWrapRegion will produce an exact NSW range since we are
- // passing a single element range.
+ // makeGuaranteedNoWrapRegion will produce an exact NSW range.
auto NSWRange = ConstantRange::makeGuaranteedNoWrapRegion(BinaryOperator::Add,
ConstantRange(Other),
OverflowingBinaryOperator::NoSignedWrap);
OpenPOWER on IntegriCloud