Skip to content

Commit

Permalink
The variable "Latch" is only used in an assert, which makes builds th…
Browse files Browse the repository at this point in the history
…at 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
  • Loading branch information
Sterling-Augustine committed Jul 12, 2019
1 parent 38ec89a commit 6d75a9e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 6d75a9e

Please sign in to comment.