From 3dadee385464c8b8e64a37239ef7c38953c7bad5 Mon Sep 17 00:00:00 2001 From: Max Kazantsev Date: Fri, 4 Aug 2017 05:06:44 +0000 Subject: [PATCH] Fix SCEVExitLimitForget tests to make Sanitizer happy git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@310023 91177308-0d34-0410-b5e6-96231b3b80d8 --- unittests/Analysis/ScalarEvolutionTest.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/unittests/Analysis/ScalarEvolutionTest.cpp b/unittests/Analysis/ScalarEvolutionTest.cpp index 3d412f43d27..94850a030c7 100644 --- a/unittests/Analysis/ScalarEvolutionTest.cpp +++ b/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(EC)); + EXPECT_TRUE(isa(EC)); + EXPECT_EQ(cast(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(NewEC)); + EXPECT_TRUE(isa(NewEC)); + EXPECT_EQ(cast(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(EC)); + EXPECT_FALSE(isa(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(NewEC)); + EXPECT_TRUE(isa(NewEC)); + EXPECT_EQ(cast(NewEC)->getAPInt().getLimitedValue(), 1999); } } // end anonymous namespace -- 2.40.0