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();
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
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();
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