]> granicus.if.org Git - llvm/commit
[ConstantRange] Add signed/unsigned unionWith()
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 7 Apr 2019 20:20:24 +0000 (20:20 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 7 Apr 2019 20:20:24 +0000 (20:20 +0000)
commitc62bb1e099d4cb81d67677a98d39dbea67cf89ed
treed3c59b1ed9b480920f3c0d2eb146bb20c875710f
parent7ef283f68dcbaab64cf310dfe8014145a189687d
[ConstantRange] Add signed/unsigned unionWith()

This extends D59959 to unionWith(), allowing to specify that a
non-wrapping unsigned/signed range is preferred. This is somewhat
less useful than the intersect case, because union operations are
rarer. An example use would the the phi union computed in SCEV.

The implementation is mostly a straightforward use of getPreferredRange(),
but I also had to adjust some <=/< checks to make sure that no ranges with
lower==upper get constructed before they're passed to getPreferredRange(),
as these have additional constraints.

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

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