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

Sterling Augustine via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 11:51:08 PDT 2019


Author: saugustine
Date: Fri Jul 12 11:51:08 2019
New Revision: 365943

URL: http://llvm.org/viewvc/llvm-project?rev=365943&view=rev
Log:
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

Modified:
    llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp?rev=365943&r1=365942&r2=365943&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/IndVarSimplify.cpp Fri Jul 12 11:51:08 2019
@@ -2627,7 +2627,6 @@ bool IndVarSimplify::sinkUnusedInvariant
 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(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);




More information about the llvm-commits mailing list