aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantRange.cpp
diff options
context:
space:
mode:
authorDouglas Yung <douglas.yung@sony.com>2022-05-20 10:21:24 -0700
committerDouglas Yung <douglas.yung@sony.com>2022-05-20 10:24:20 -0700
commit54e3bf5f37d67441dafbc66838a54a385293a2e1 (patch)
tree69751a1dd1d8aa62e006dd57f5ed2fd2c0d1dae0 /llvm/lib/IR/ConstantRange.cpp
parentf2df53b75071736009d68ba73e86edf7e25cebbd (diff)
downloadllvm-54e3bf5f37d67441dafbc66838a54a385293a2e1.zip
llvm-54e3bf5f37d67441dafbc66838a54a385293a2e1.tar.gz
llvm-54e3bf5f37d67441dafbc66838a54a385293a2e1.tar.bz2
Revert "[ConstantRange] Improve the implementation of binaryOr"
This reverts commit 6990e7477d24ff585ae86549f5280f0be65422a6. This change was causing the test compiler-rt/test/fuzzer/merge_two_step.test to fail on our internal bot as well as other build bots such as https://lab.llvm.org/buildbot/#/builders/179/builds/3712.
Diffstat (limited to 'llvm/lib/IR/ConstantRange.cpp')
-rw-r--r--llvm/lib/IR/ConstantRange.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp
index be6386c..c3915ce 100644
--- a/llvm/lib/IR/ConstantRange.cpp
+++ b/llvm/lib/IR/ConstantRange.cpp
@@ -1410,13 +1410,14 @@ ConstantRange ConstantRange::binaryOr(const ConstantRange &Other) const {
if (isEmptySet() || Other.isEmptySet())
return getEmpty();
- ConstantRange KnownBitsRange =
- fromKnownBits(toKnownBits() | Other.toKnownBits(), false);
- // Upper wrapped range.
- ConstantRange UMaxUMinRange =
- getNonEmpty(APIntOps::umax(getUnsignedMin(), Other.getUnsignedMin()),
- APInt::getZero(getBitWidth()));
- return KnownBitsRange.intersectWith(UMaxUMinRange);
+ // Use APInt's implementation of OR for single element ranges.
+ if (isSingleElement() && Other.isSingleElement())
+ return {*getSingleElement() | *Other.getSingleElement()};
+
+ // TODO: replace this with something less conservative
+
+ APInt umax = APIntOps::umax(getUnsignedMin(), Other.getUnsignedMin());
+ return getNonEmpty(std::move(umax), APInt::getZero(getBitWidth()));
}
ConstantRange ConstantRange::binaryXor(const ConstantRange &Other) const {