The variable "Latch" is only used in an assert, which makes builds that use "-DNDEBUG...
authorSterling Augustine <saugustine@google.com>
Fri, 12 Jul 2019 18:51:08 +0000 (18:51 +0000)
committerSterling Augustine <saugustine@google.com>
Fri, 12 Jul 2019 18:51:08 +0000 (18:51 +0000)
Summary: Move the logic into the assert itself.

Subscribers: hiraditya, sanjoy, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@365943 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/IndVarSimplify.cpp

index 7f2979a903078000898f9404dd3b351fc45f6885..70508bf752580b637166f6f8578d059268f3021b 100644 (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);