mirror of
https://github.com/RPCS3/llvm.git
synced 2025-05-15 18:06:08 +00:00

If a switch was in an unreachable block that branched to a block with a phi, it would leave phis with missing predecessors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301064 91177308-0d34-0410-b5e6-96231b3b80d8
41 lines
1.0 KiB
LLVM
41 lines
1.0 KiB
LLVM
; RUN: opt -S -lowerswitch %s | FileCheck %s
|
|
|
|
; CHECK-LABEL: @phi_in_dead_block(
|
|
; CHECK-NOT: switch
|
|
define void @phi_in_dead_block() {
|
|
bb:
|
|
br i1 undef, label %bb2, label %bb3
|
|
|
|
bb1: ; No predecessors!
|
|
switch i32 undef, label %bb2 [
|
|
i32 9, label %bb3
|
|
]
|
|
|
|
bb2: ; preds = %bb1, %bb
|
|
%tmp = phi i64 [ undef, %bb1 ], [ undef, %bb ]
|
|
unreachable
|
|
|
|
bb3: ; preds = %bb1, %bb
|
|
unreachable
|
|
}
|
|
|
|
; CHECK-LABEL: @phi_in_dead_block_br_to_self(
|
|
; CHECK-NOT: switch
|
|
define void @phi_in_dead_block_br_to_self() {
|
|
bb:
|
|
br i1 undef, label %bb2, label %bb3
|
|
|
|
bb1: ; No predecessors!
|
|
switch i32 undef, label %bb2 [
|
|
i32 9, label %bb3
|
|
i32 10, label %bb1
|
|
]
|
|
|
|
bb2: ; preds = %bb1, %bb
|
|
%tmp = phi i64 [ undef, %bb1 ], [ undef, %bb ]
|
|
unreachable
|
|
|
|
bb3: ; preds = %bb1, %bb
|
|
unreachable
|
|
}
|