]> granicus.if.org Git - llvm/commitdiff
[ConstantRange] Add another truncate unittest for wrapped set staying a wrapped set.
authorCraig Topper <craig.topper@gmail.com>
Sun, 4 Jun 2017 23:07:53 +0000 (23:07 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 4 Jun 2017 23:07:53 +0000 (23:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304695 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/IR/ConstantRangeTest.cpp

index c6a0ef8f1b71b68cc4e5139f59dfc6b8efef5c70..0292f60fe3322dc33b2afe2ff656a710af9055ed 100644 (file)
@@ -200,6 +200,10 @@ TEST_F(ConstantRangeTest, Trunc) {
   // trunc([5, 7), 3->2) = [1, 3)
   ConstantRange FiveSeven(APInt(3, 5), APInt(3, 7));
   EXPECT_EQ(FiveSeven.truncate(2), ConstantRange(APInt(2, 1), APInt(2, 3)));
+
+  // trunc([7, 1), 3->2) = [3, 1)
+  ConstantRange SevenOne(APInt(3, 7), APInt(3, 1));
+  EXPECT_EQ(SevenOne.truncate(2), ConstantRange(APInt(2, 3), APInt(2, 1)));
 }
 
 TEST_F(ConstantRangeTest, ZExt) {