The variable "Latch" is only used in an assert, which makes builds that use "-DNDEBUG" fail with unused variable messages.

Summary: Move the logic into the assert itself.

Subscribers: hiraditya, sanjoy, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D64654

llvm-svn: 365943
This commit is contained in:
Sterling Augustine 2019-07-12 18:51:08 +00:00
parent 38ec89a670
commit 6d75a9e873
1 changed files with 1 additions and 2 deletions

View File

@ -2627,7 +2627,6 @@ bool IndVarSimplify::sinkUnusedInvariants(Loop *L) {
bool IndVarSimplify::optimizeLoopExits(Loop *L) {
SmallVector<BasicBlock*, 16> ExitingBlocks;
L->getExitingBlocks(ExitingBlocks);
BasicBlock * const Latch = L->getLoopLatch();
// Form an expression for the maximum exit count possible for this loop. We
// merge the max and exact information to approximate a version of
@ -2641,7 +2640,7 @@ bool IndVarSimplify::optimizeLoopExits(Loop *L) {
for (BasicBlock *ExitingBB : ExitingBlocks) {
const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
if (!isa<SCEVCouldNotCompute>(ExitCount)) {
assert(DT->dominates(ExitingBB, Latch) &&
assert(DT->dominates(ExitingBB, L->getLoopLatch()) &&
"We should only have known counts for exiting blocks that "
"dominate latch!");
ExitCounts.push_back(ExitCount);