]> granicus.if.org Git - llvm/commit
[ConstantRange] Add urem support
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 23 Apr 2019 18:00:17 +0000 (18:00 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 23 Apr 2019 18:00:17 +0000 (18:00 +0000)
commite2e04eaba9e2b701fc7efce2f563988e572e3cc1
treedbf7c0320d9ca765d85f3a6d0fb6615fefef8ead
parent63748dd992c6daa7ba676934072476f55f20d3f9
[ConstantRange] Add urem support

Add urem support to ConstantRange, so we can handle in in LVI. This
is an approximate implementation that tries to capture the most useful
conditions: If the LHS is always strictly smaller than the RHS, then
the urem is a no-op and the result is the same as the LHS range.
Otherwise the lower bound is zero and the upper bound is
min(LHSMax, RHSMax - 1).

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

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