[llvm] r310023 - Fix SCEVExitLimitForget tests to make Sanitizer happy
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 3 22:06:44 PDT 2017
Author: mkazantsev
Date: Thu Aug 3 22:06:44 2017
New Revision: 310023
URL: http://llvm.org/viewvc/llvm-project?rev=310023&view=rev
Log:
Fix SCEVExitLimitForget tests to make Sanitizer happy
Modified:
llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp
Modified: llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp?rev=310023&r1=310022&r2=310023&view=diff
==============================================================================
--- llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp (original)
+++ llvm/trunk/unittests/Analysis/ScalarEvolutionTest.cpp Thu Aug 3 22:06:44 2017
@@ -994,6 +994,8 @@ TEST_F(ScalarEvolutionsTest, SCEVExitLim
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, SCEVExitLim
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, SCEVExitLim
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, SCEVExitLim
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
More information about the llvm-commits
mailing list