[PATCH] D57231: [LoopSimplifyCFG] Pay respect to LCSSA when removing dead blocks
Max Kazantsev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 11 23:47:54 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL353803: [LoopSimplifyCFG] Pay respect to LCSSA when removing dead blocks (authored by mkazantsev, committed by ).
Herald added a project: LLVM.
Changed prior to commit:
https://reviews.llvm.org/D57231?vs=183518&id=186407#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57231/new/
https://reviews.llvm.org/D57231
Files:
llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
llvm/trunk/test/Transforms/LoopSimplifyCFG/lcssa.ll
Index: llvm/trunk/test/Transforms/LoopSimplifyCFG/lcssa.ll
===================================================================
--- llvm/trunk/test/Transforms/LoopSimplifyCFG/lcssa.ll
+++ llvm/trunk/test/Transforms/LoopSimplifyCFG/lcssa.ll
@@ -1,6 +1,4 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; XFAIL: *
-; REQUIRES: asserts
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -loop-simplifycfg -verify-loop-info -verify-dom-info -verify-loop-lcssa < %s | FileCheck %s
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -passes='require<domtree>,loop(simplify-cfg)' -verify-loop-info -verify-dom-info -verify-loop-lcssa < %s | FileCheck %s
; RUN: opt -S -enable-loop-simplifycfg-term-folding=true -loop-simplifycfg -enable-mssa-loop-dependency=true -verify-memoryssa -verify-loop-info -verify-dom-info -verify-loop-lcssa < %s | FileCheck %s
@@ -93,8 +91,31 @@
}
define void @bar() {
-
-; CHECK-LABEL: @bar
+; CHECK-LABEL: @bar(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: switch i32 0, label [[BB_SPLIT:%.*]] [
+; CHECK-NEXT: i32 1, label [[BB10:%.*]]
+; CHECK-NEXT: ]
+; CHECK: bb-split:
+; CHECK-NEXT: br label [[BB1:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: [[TMP:%.*]] = phi i32 [ [[TMP7:%.*]], [[BB6:%.*]] ], [ undef, [[BB_SPLIT]] ]
+; CHECK-NEXT: switch i32 undef, label [[BB5:%.*]] [
+; CHECK-NEXT: i32 0, label [[BB6]]
+; CHECK-NEXT: i32 1, label [[BB8:%.*]]
+; CHECK-NEXT: ]
+; CHECK: bb5:
+; CHECK-NEXT: ret void
+; CHECK: bb6:
+; CHECK-NEXT: [[TMP7]] = add i32 undef, 123
+; CHECK-NEXT: br label [[BB1]]
+; CHECK: bb8:
+; CHECK-NEXT: [[TMP9:%.*]] = phi i32 [ [[TMP]], [[BB1]] ]
+; CHECK-NEXT: [[USE:%.*]] = add i32 [[TMP9]], 1
+; CHECK-NEXT: ret void
+; CHECK: bb10:
+; CHECK-NEXT: ret void
+;
bb:
br label %bb1
@@ -105,8 +126,8 @@
bb2: ; preds = %bb1
switch i32 undef, label %bb10 [
- i32 0, label %bb3
- i32 1, label %bb8
+ i32 0, label %bb3
+ i32 1, label %bb8
]
bb3: ; preds = %bb2
@@ -114,8 +135,8 @@
bb4: ; preds = %bb1
switch i32 undef, label %bb5 [
- i32 0, label %bb6
- i32 1, label %bb8
+ i32 0, label %bb6
+ i32 1, label %bb8
]
bb5: ; preds = %bb4
Index: llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
+++ llvm/trunk/lib/Transforms/Scalar/LoopSimplifyCFG.cpp
@@ -418,7 +418,7 @@
LI.removeBlock(BB);
}
- DetatchDeadBlocks(DeadLoopBlocks, &DTUpdates);
+ DetatchDeadBlocks(DeadLoopBlocks, &DTUpdates, /*KeepOneInputPHIs*/true);
DTU.applyUpdates(DTUpdates);
DTUpdates.clear();
for (auto *BB : DeadLoopBlocks)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57231.186407.patch
Type: text/x-patch
Size: 2944 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190212/668c5f7b/attachment.bin>
More information about the llvm-commits
mailing list