summaryrefslogtreecommitdiff
path: root/unittests/Support
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2009-07-19 03:44:35 +0000
committerNick Lewycky <nicholas@mxc.ca>2009-07-19 03:44:35 +0000
commit7e7dc45eb15d3739564f2a63ab1c468c57d94ff8 (patch)
tree82087bb071e8db26508c488b7009c2bd7ba4bd41 /unittests/Support
parentaafa94260d5b1b6422258ed3db7244fe4449f217 (diff)
downloadllvm-7e7dc45eb15d3739564f2a63ab1c468c57d94ff8.tar.gz
llvm-7e7dc45eb15d3739564f2a63ab1c468c57d94ff8.tar.bz2
llvm-7e7dc45eb15d3739564f2a63ab1c468c57d94ff8.tar.xz
Fix ConstantRange::unionWith. Also make it work a little hard in some cases to
return the smallest union of two ranges instead of just any range that happens to contain the union. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Support')
-rw-r--r--unittests/Support/ConstantRangeTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/Support/ConstantRangeTest.cpp b/unittests/Support/ConstantRangeTest.cpp
index b77ac6aece..b1b82a9927 100644
--- a/unittests/Support/ConstantRangeTest.cpp
+++ b/unittests/Support/ConstantRangeTest.cpp
@@ -219,6 +219,17 @@ TEST_F(ConstantRangeTest, UnionWith) {
EXPECT_TRUE(Empty.unionWith(Empty).isEmptySet());
EXPECT_TRUE(Full.unionWith(Full).isFullSet());
EXPECT_TRUE(Some.unionWith(Wrap).isFullSet());
+
+ // PR4545
+ EXPECT_EQ(ConstantRange(APInt(16, 14), APInt(16, 1)).unionWith(
+ ConstantRange(APInt(16, 0), APInt(16, 8))),
+ ConstantRange(APInt(16, 14), APInt(16, 8)));
+ EXPECT_EQ(ConstantRange(APInt(16, 6), APInt(16, 4)).unionWith(
+ ConstantRange(APInt(16, 4), APInt(16, 0))),
+ ConstantRange(16));
+ EXPECT_EQ(ConstantRange(APInt(16, 1), APInt(16, 0)).unionWith(
+ ConstantRange(APInt(16, 2), APInt(16, 1))),
+ ConstantRange(16));
}
TEST_F(ConstantRangeTest, SubtractAPInt) {