[PATCH] D57147: [LoopSimplifyCFG] Fix inconsistency in blocks in loop markup

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 24 21:05:17 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL352170: [LoopSimplifyCFG] Fix inconsistency in blocks in loop markup (authored by mkazantsev, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D57147?vs=183283&id=183477#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57147/new/

https://reviews.llvm.org/D57147

Files:
  llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
  llvm/trunk/test/Transforms/LoopSimplifyCFG/live_block_marking.ll


Index: llvm/trunk/test/Transforms/LoopSimplifyCFG/live_block_marking.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopSimplifyCFG/live_block_marking.ll
+++ llvm/trunk/test/Transforms/LoopSimplifyCFG/live_block_marking.ll
@@ -4,11 +4,13 @@
 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -passes='require<domtree>,loop(indvars,simplify-cfg)' -debug-only=loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
 ; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -indvars -loop-simplifycfg -enable-mssa-loop-dependency=true -verify-memoryssa -debug-only=loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa 2>&1 < %s | FileCheck %s
 
-; This test demonstrates a bug in live blocks markup that is only catchable in
-; inter-pass interaction.
 define void @test(i1 %c) {
 ; CHECK-LABEL: @test(
 ; CHECK-NEXT:  entry:
+; CHECK-NEXT:    switch i32 0, label [[ENTRY_SPLIT:%.*]] [
+; CHECK-NEXT:    i32 1, label [[DEAD_EXIT:%.*]]
+; CHECK-NEXT:    ]
+; CHECK:       entry-split:
 ; CHECK-NEXT:    br label [[OUTER:%.*]]
 ; CHECK:       outer:
 ; CHECK-NEXT:    br i1 [[C:%.*]], label [[TO_FOLD:%.*]], label [[LATCH:%.*]]
@@ -25,7 +27,7 @@
 ; CHECK:       latch.loopexit:
 ; CHECK-NEXT:    br label [[LATCH]]
 ; CHECK:       latch:
-; CHECK-NEXT:    br i1 true, label [[OUTER]], label [[DEAD_EXIT:%.*]]
+; CHECK-NEXT:    br label [[OUTER]]
 ; CHECK:       dead_exit:
 ; CHECK-NEXT:    ret void
 ;
Index: llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -239,7 +239,7 @@
       if (!LiveLoopBlocks.count(From))
         return false;
       BasicBlock *TheOnlySucc = getOnlyLiveSuccessor(From);
-      return !TheOnlySucc || TheOnlySucc == To;
+      return !TheOnlySucc || TheOnlySucc == To || LI.getLoopFor(From) != &L;
     };
 
     // The loop will not be destroyed if its latch is live.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57147.183477.patch
Type: text/x-patch
Size: 2103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190125/8d4ce6e4/attachment.bin>


More information about the llvm-commits mailing list