Skip to content

Commit e6b291a

Browse files
committed
Revert "[SimpleLoopUnswitch] Preserve one PHI when removing a predecessor of a BB"
This reverts commit b164143.
1 parent 5d2867b commit e6b291a

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1716,7 +1716,7 @@ static void deleteDeadBlocksFromLoop(Loop &L,
17161716
auto *BB = DeathCandidates.pop_back_val();
17171717
if (!DeadBlockSet.count(BB) && !DT.isReachableFromEntry(BB)) {
17181718
for (BasicBlock *SuccBB : successors(BB)) {
1719-
SuccBB->removePredecessor(BB, /*KeepOneInputPHIs*/ true);
1719+
SuccBB->removePredecessor(BB);
17201720
DeathCandidates.push_back(SuccBB);
17211721
}
17221722
DeadBlockSet.insert(BB);

llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch-pred-removed.ll

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
; RUN: opt -passes='loop-mssa(simple-loop-unswitch<nontrivial>),print<memoryssa>' -verify-memoryssa -disable-output -S < %s 2>&1 | FileCheck %s
2-
; RUN: opt -passes='loop-mssa(simple-loop-unswitch<nontrivial>,licm)' -verify-memoryssa -disable-output -S
32

4-
; Check that SimpleLoopUnswitch preserves the MemoryDef of `call i32 @bar()` by preserving the PHI node.
5-
; Also, check that executing LICM after SimpleLoopUnswitch does not result in a crash.
6-
7-
; CHECK: %unswitched.select = phi ptr [ @bar, %bb2 ]
3+
; CHECK: preds = %bb2{{$}}
84
; CHECK-NEXT: MemoryDef
9-
; CHECK-NEXT: call i32 %unswitched.select()
5+
; CHECK-NEXT: call i32 @bar()
106

117
define i32 @foo(i1 %arg, ptr %arg1) {
128
bb:

0 commit comments

Comments
 (0)