Implement ConstantRange::multiply based on the code in LoopVR.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75410 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/unittests/Support/ConstantRangeTest.cpp b/unittests/Support/ConstantRangeTest.cpp
index 83bf535..4a9e972 100644
--- a/unittests/Support/ConstantRangeTest.cpp
+++ b/unittests/Support/ConstantRangeTest.cpp
@@ -267,17 +267,13 @@
   EXPECT_EQ(Empty.multiply(One), Empty);
   EXPECT_EQ(Empty.multiply(Some), Empty);
   EXPECT_EQ(Empty.multiply(Wrap), Empty);
-  // TODO: ConstantRange is currently over-conservative here.
-  EXPECT_EQ(One.multiply(One), Full);
-  // TODO: ConstantRange is currently over-conservative here.
-  EXPECT_EQ(One.multiply(Some), Full);
-  // TODO: ConstantRange is currently over-conservative here.
-  EXPECT_EQ(One.multiply(Wrap), Full);
-  // TODO: ConstantRange is currently over-conservative here.
-  EXPECT_EQ(Some.multiply(Some), Full);
-  // TODO: ConstantRange is currently over-conservative here.
+  EXPECT_EQ(One.multiply(One), ConstantRange(APInt(16, 0xa*0xa),
+                                             APInt(16, 0xa*0xa + 1)));
+  EXPECT_EQ(One.multiply(Some), ConstantRange(APInt(16, 0xa*0xa),
+                                              APInt(16, 0xa*0xaa9 + 1)));
+  EXPECT_TRUE(One.multiply(Wrap).isFullSet());
+  EXPECT_TRUE(Some.multiply(Some).isFullSet());
   EXPECT_EQ(Some.multiply(Wrap), Full);
-  // TODO: ConstantRange is currently over-conservative here.
   EXPECT_EQ(Wrap.multiply(Wrap), Full);
 }