diff options
| author | Nuno Lopes <nunoplopes@sapo.pt> | 2012-05-18 00:14:36 +0000 |
|---|---|---|
| committer | Nuno Lopes <nunoplopes@sapo.pt> | 2012-05-18 00:14:36 +0000 |
| commit | 63afc08ca7c8a511d4dcf5c288b4204427cc4e1f (patch) | |
| tree | 2787faa0309a2bc0c70d9a4bb889e893b64de086 /llvm/unittests/Support/ConstantRangeTest.cpp | |
| parent | badd100c260da2cb4ec6f82e1c68c7e203082511 (diff) | |
| download | bcm5719-llvm-63afc08ca7c8a511d4dcf5c288b4204427cc4e1f.tar.gz bcm5719-llvm-63afc08ca7c8a511d4dcf5c288b4204427cc4e1f.zip | |
fix corner case in ConstantRange::intersectWith().
this fixes the missed optimization I was seeing in the CorrelatedValuePropagation pass
llvm-svn: 157032
Diffstat (limited to 'llvm/unittests/Support/ConstantRangeTest.cpp')
| -rw-r--r-- | llvm/unittests/Support/ConstantRangeTest.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/unittests/Support/ConstantRangeTest.cpp b/llvm/unittests/Support/ConstantRangeTest.cpp index 742bcb48ecc..5fcdcfd2b4c 100644 --- a/llvm/unittests/Support/ConstantRangeTest.cpp +++ b/llvm/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) { |

