[ConstantRange] Add getNonEmpty() constructor
authorNikita Popov <nikita.ppv@gmail.com>
Sun, 21 Apr 2019 15:22:54 +0000 (15:22 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 21 Apr 2019 15:22:54 +0000 (15:22 +0000)
commitdbc3fbafe7cbf10bac30da4d4b6eb6082fed3daa
tree5ca3301d2c529849b90e76efc5bda9f91583ab70
parent7fa3a0eec9792c5da235ade683013a742871b8c5
[ConstantRange] Add getNonEmpty() constructor

ConstantRanges have an annoying special case: If upper and lower are
the same, it can be either an empty or a full set. When constructing
constant ranges nearly always a full set is intended, but this still
requires an explicit check in many places.

This revision adds a getNonEmpty() constructor that disambiguates this
case: If upper and lower are the same, a full set is created.

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

llvm-svn: 358854
llvm/include/llvm/IR/ConstantRange.h
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/lib/Analysis/ValueTracking.cpp
llvm/lib/IR/ConstantRange.cpp