summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Analysis
diff options
context:
space:
mode:
authorMax Kazantsev <max.kazantsev@azul.com>2017-08-04 05:06:44 +0000
committerMax Kazantsev <max.kazantsev@azul.com>2017-08-04 05:06:44 +0000
commitba1e70e060aeab0b8cb97dc39fe2a8338cf72cf1 (patch)
treed4292c9d1c37a66d84882022a371aba49b436947 /llvm/unittests/Analysis
parent3f47a5c054f195e76de87aeddc09ce0f8ead7359 (diff)
downloadbcm5719-llvm-ba1e70e060aeab0b8cb97dc39fe2a8338cf72cf1.tar.gz
bcm5719-llvm-ba1e70e060aeab0b8cb97dc39fe2a8338cf72cf1.zip
Fix SCEVExitLimitForget tests to make Sanitizer happy
llvm-svn: 310023
Diffstat (limited to 'llvm/unittests/Analysis')
-rw-r--r--llvm/unittests/Analysis/ScalarEvolutionTest.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
index 3d412f43d27..94850a030c7 100644
--- a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
+++ b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp
@@ -994,6 +994,8 @@ TEST_F(ScalarEvolutionsTest, SCEVExitLimitForgetLoop) {
auto *Loop = LI->getLoopFor(L);
const SCEV *EC = SE.getBackedgeTakenCount(Loop);
EXPECT_FALSE(isa<SCEVCouldNotCompute>(EC));
+ EXPECT_TRUE(isa<SCEVConstant>(EC));
+ EXPECT_EQ(cast<SCEVConstant>(EC)->getAPInt().getLimitedValue(), 999);
SE.forgetLoop(Loop);
Br->eraseFromParent();
@@ -1004,7 +1006,9 @@ TEST_F(ScalarEvolutionsTest, SCEVExitLimitForgetLoop) {
ICmpInst::ICMP_SLT, Add, ConstantInt::get(T_int64, 2000), "new.cond");
Builder.CreateCondBr(NewCond, L, Post);
const SCEV *NewEC = SE.getBackedgeTakenCount(Loop);
- EXPECT_NE(EC, NewEC);
+ EXPECT_FALSE(isa<SCEVCouldNotCompute>(NewEC));
+ EXPECT_TRUE(isa<SCEVConstant>(NewEC));
+ EXPECT_EQ(cast<SCEVConstant>(NewEC)->getAPInt().getLimitedValue(), 1999);
}
// Make sure that SCEV invalidates exit limits after invalidating the values it
@@ -1074,6 +1078,7 @@ TEST_F(ScalarEvolutionsTest, SCEVExitLimitForgetValue) {
auto *Loop = LI->getLoopFor(L);
const SCEV *EC = SE.getBackedgeTakenCount(Loop);
EXPECT_FALSE(isa<SCEVCouldNotCompute>(EC));
+ EXPECT_FALSE(isa<SCEVConstant>(EC));
SE.forgetValue(Load);
Br->eraseFromParent();
@@ -1085,7 +1090,9 @@ TEST_F(ScalarEvolutionsTest, SCEVExitLimitForgetValue) {
ICmpInst::ICMP_SLT, Add, ConstantInt::get(T_int64, 2000), "new.cond");
Builder.CreateCondBr(NewCond, L, Post);
const SCEV *NewEC = SE.getBackedgeTakenCount(Loop);
- EXPECT_NE(EC, NewEC);
+ EXPECT_FALSE(isa<SCEVCouldNotCompute>(NewEC));
+ EXPECT_TRUE(isa<SCEVConstant>(NewEC));
+ EXPECT_EQ(cast<SCEVConstant>(NewEC)->getAPInt().getLimitedValue(), 1999);
}
} // end anonymous namespace
OpenPOWER on IntegriCloud