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

Sterling Augustine via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 11:50:44 PDT 2019


saugustine created this revision.
Herald added subscribers: llvm-commits, sanjoy, hiraditya.
Herald added a project: LLVM.

Move the logic into the assert itself.


Repository:
  rL LLVM

https://reviews.llvm.org/D64654

Files:
  llvm/lib/Transforms/Scalar/IndVarSimplify.cpp


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -2627,7 +2627,6 @@
 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 @@
   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);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64654.209552.patch
Type: text/x-patch
Size: 1019 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190712/1752aecd/attachment.bin>


More information about the llvm-commits mailing list