[PATCH] D57095: [LoopSimplifyCFG] Fix inconsistency in live blocks markup
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 23 21:20:54 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL352024: [LoopSimplifyCFG] Fix inconsistency in live blocks markup (authored by mkazantsev, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D57095?vs=183243&id=183245#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57095/new/
https://reviews.llvm.org/D57095
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
@@ -1,4 +1,4 @@
-; XFAIL: *
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; REQUIRES: asserts
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -indvars -loop-simplifycfg -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 -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
@@ -7,8 +7,28 @@
; 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: br label [[OUTER:%.*]]
+; CHECK: outer:
+; CHECK-NEXT: br i1 [[C:%.*]], label [[TO_FOLD:%.*]], label [[LATCH:%.*]]
+; CHECK: to_fold:
+; CHECK-NEXT: br i1 [[C]], label [[LATCH]], label [[INNER_PREHEADER:%.*]]
+; CHECK: inner.preheader:
+; CHECK-NEXT: br label [[INNER:%.*]]
+; CHECK: inner:
+; CHECK-NEXT: br i1 false, label [[INNER_LATCH:%.*]], label [[UNDEAD:%.*]]
+; CHECK: inner_latch:
+; CHECK-NEXT: br i1 true, label [[INNER]], label [[LATCH_LOOPEXIT:%.*]]
+; CHECK: undead:
+; CHECK-NEXT: br label [[LATCH]]
+; CHECK: latch.loopexit:
+; CHECK-NEXT: br label [[LATCH]]
+; CHECK: latch:
+; CHECK-NEXT: br i1 true, label [[OUTER]], label [[DEAD_EXIT:%.*]]
+; CHECK: dead_exit:
+; CHECK-NEXT: ret void
+;
entry:
br label %outer
Index: llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -207,12 +207,13 @@
// folding. Only handle blocks from current loop: branches in child loops
// are skipped because if they can be folded, they should be folded during
// the processing of child loops.
- if (TheOnlySucc && LI.getLoopFor(BB) == &L)
+ bool TakeFoldCandidate = TheOnlySucc && LI.getLoopFor(BB) == &L;
+ if (TakeFoldCandidate)
FoldCandidates.push_back(BB);
// Handle successors.
for (BasicBlock *Succ : successors(BB))
- if (!TheOnlySucc || TheOnlySucc == Succ) {
+ if (!TakeFoldCandidate || TheOnlySucc == Succ) {
if (L.contains(Succ))
LiveLoopBlocks.insert(Succ);
else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57095.183245.patch
Type: text/x-patch
Size: 2790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/a5eb2588/attachment.bin>
More information about the llvm-commits
mailing list