mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[LoopSimplifyCFG] Pay respect to LCSSA when removing dead blocks
Utility function that we use for blocks deletion always unconditionally removes one-input Phis. In LoopSimplifyCFG, it can lead to breach of LCSSA form. This patch alters this function to keep them if needed. Differential Revision: https://reviews.llvm.org/D57231 Reviewed By: fedor.sergeev llvm-svn: 353803
This commit is contained in:
parent
32ede157ac
commit
5d77bf0ea9
@ -418,7 +418,7 @@ private:
|
||||
LI.removeBlock(BB);
|
||||
}
|
||||
|
||||
DetatchDeadBlocks(DeadLoopBlocks, &DTUpdates);
|
||||
DetatchDeadBlocks(DeadLoopBlocks, &DTUpdates, /*KeepOneInputPHIs*/true);
|
||||
DTU.applyUpdates(DTUpdates);
|
||||
DTUpdates.clear();
|
||||
for (auto *BB : DeadLoopBlocks)
|
||||
|
@ -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 @@ while.body: ; preds = %while.cond
|
||||
}
|
||||
|
||||
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 @@ bb1: ; preds = %bb6, %bb
|
||||
|
||||
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 @@ bb3: ; preds = %bb2
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user