[llvm] r302700 - [ConstantRange] Add test case showing a case where we pick too large of a range for multiply after r271020.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 11:15:06 PDT 2017


Author: ctopper
Date: Wed May 10 13:15:06 2017
New Revision: 302700

URL: http://llvm.org/viewvc/llvm-project?rev=302700&view=rev
Log:
[ConstantRange] Add test case showing a case where we pick too large of a range for multiply after r271020.

Modified:
    llvm/trunk/unittests/IR/ConstantRangeTest.cpp

Modified: llvm/trunk/unittests/IR/ConstantRangeTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/IR/ConstantRangeTest.cpp?rev=302700&r1=302699&r2=302700&view=diff
==============================================================================
--- llvm/trunk/unittests/IR/ConstantRangeTest.cpp (original)
+++ llvm/trunk/unittests/IR/ConstantRangeTest.cpp Wed May 10 13:15:06 2017
@@ -443,6 +443,11 @@ TEST_F(ConstantRangeTest, Multiply) {
   EXPECT_EQ(ConstantRange(APInt(8, 254), APInt(8, 255)).multiply(
               ConstantRange(APInt(8, 2), APInt(8, 4))),
             ConstantRange(APInt(8, 250), APInt(8, 253)));
+
+  // TODO: This should be return [-2, 0]
+  EXPECT_EQ(ConstantRange(APInt(8, -2)).multiply(
+              ConstantRange(APInt(8, 0), APInt(8, 2))),
+            ConstantRange(APInt(8, 0), APInt(8, 255)));
 }
 
 TEST_F(ConstantRangeTest, UMax) {




More information about the llvm-commits mailing list