[ConstantRange] Add makeExactNoWrapRegion()
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 28 Apr 2019 15:40:56 +0000 (15:40 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 28 Apr 2019 15:40:56 +0000 (15:40 +0000)
commit7a94795b2b7fb9eb3f9bbfa514f3b28fec59408a
tree82e3c51412a3b2c73aacb251e45cc72b864830fe
parentd394195221ad1a446e0318b7417abd1076512243
[ConstantRange] Add makeExactNoWrapRegion()

I got confused on the terminology, and the change in D60598 was not
correct. I was thinking of "exact" in terms of the result being
non-approximate. However, the relevant distinction here is whether
the result is

 * Largest range such that:
   Forall Y in Other: Forall X in Result: X BinOp Y does not wrap.
   (makeGuaranteedNoWrapRegion)
 * Smallest range such that:
   Forall Y in Other: Forall X not in Result: X BinOp Y wraps.
   (A hypothetical makeAllowedNoWrapRegion)
 * Both. (makeExactNoWrapRegion)

I'm adding a separate makeExactNoWrapRegion method accepting a
single APInt (same as makeExactICmpRegion) and using it in the
places where the guarantee is relevant.

Differential Revision: https://reviews.llvm.org/D60960

llvm-svn: 359402
llvm/include/llvm/IR/ConstantRange.h
llvm/lib/Analysis/LazyValueInfo.cpp
llvm/lib/IR/ConstantRange.cpp
llvm/unittests/IR/ConstantRangeTest.cpp