aboutsummaryrefslogtreecommitdiff
path: root/unittests
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2012-05-18 00:14:36 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2012-05-18 00:14:36 +0000
commitfbb7a73631e3c23510abb3904e8ad38c87ff2a24 (patch)
tree432dd13e2b35e0979490e10e13c2d9862dc4000d /unittests
parent59c15e920c9873804f3150d0c13357696f09e300 (diff)
fix corner case in ConstantRange::intersectWith().
this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/ConstantRangeTest.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/unittests/Support/ConstantRangeTest.cpp b/unittests/Support/ConstantRangeTest.cpp
index 742bcb48ec..5fcdcfd2b4 100644
--- a/unittests/Support/ConstantRangeTest.cpp
+++ b/unittests/Support/ConstantRangeTest.cpp
@@ -232,6 +232,11 @@ TEST_F(ConstantRangeTest, IntersectWith) {
ConstantRange LHS(APInt(16, 4), APInt(16, 2));
ConstantRange RHS(APInt(16, 6), APInt(16, 5));
EXPECT_TRUE(LHS.intersectWith(RHS) == LHS);
+
+ // previous bug: intersection of [min, 3) and [2, max) should be 2
+ LHS = ConstantRange(APInt(32, -2147483648), APInt(32, 3));
+ RHS = ConstantRange(APInt(32, 2), APInt(32, 2147483648));
+ EXPECT_EQ(LHS.intersectWith(RHS), ConstantRange(APInt(32, 2)));
}
TEST_F(ConstantRangeTest, UnionWith) {