OSDN Git Service

[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)
commit3547a7e64e67c7283558a9812b6cf7cda9507bd0
treeffb554772d8c23569a6a1ae6424ff9ed25d8086a
parent2fa97aca166881ecc24a236ab215b0e4e55fb942
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359402 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/ConstantRange.h
lib/Analysis/LazyValueInfo.cpp
lib/IR/ConstantRange.cpp
unittests/IR/ConstantRangeTest.cpp