[ConstantRange] Add getEquivalentICmp() variant with offset (NFCI)
authorNikita Popov <nikita.ppv@gmail.com>
Sat, 6 Nov 2021 20:56:53 +0000 (21:56 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 6 Nov 2021 20:59:45 +0000 (21:59 +0100)
commit9f0194be4570469ce830e6d581d21c75650562c7
treed7dc95df5e9846490a242eaaaa001259e1e8fd11
parentcefc01fa65a7ebcc10cbf3c3bb2278a6a122deaf
[ConstantRange] Add getEquivalentICmp() variant with offset (NFCI)

Add a variant of getEquivalentICmp() that produces an optional
offset. This allows us to create an equivalent icmp for all ranges.

Use this in the with.overflow folding code, which was doing this
adjustment separately -- this clarifies that the fold will indeed
always apply.
llvm/include/llvm/IR/ConstantRange.h
llvm/lib/IR/ConstantRange.cpp
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/unittests/IR/ConstantRangeTest.cpp