1 ; RUN: opt -lowerswitch -S < %s | FileCheck %s
3 ; Test that we don't crash and have a different basic block for each incoming edge.
6 ; CHECK: %merge = phi i64 [ 1, %BB3 ], [ 0, %NewDefault ], [ 0, %NodeBlock5 ], [ 0, %LeafBlock1 ]
8 switch i32 undef, label %BB2 [
17 %merge = phi i64 [ 1, %BB3 ], [ 0, %BB1 ], [ 0, %BB1 ], [ 0, %BB1 ]
24 ; Test switch cases that are merged into a single case during lowerswitch
25 ; (take 84 and 85 below) - check that the number of incoming phi values match
26 ; the number of branches.
27 define void @test1() {
33 switch i32 undef, label %bb1 [
46 ; CHECK: %tmp = phi i32 [ 1, %NodeBlock ], [ 0, %bb2 ], [ 1, %LeafBlock3 ]
47 %tmp = phi i32 [ 1, %bb1 ], [ 0, %bb2 ], [ 1, %bb1 ], [ 1, %bb1 ]
48 ; CHECK-NEXT: %tmp2 = phi i32 [ 2, %NodeBlock ], [ 5, %bb2 ], [ 2, %LeafBlock3 ]
49 %tmp2 = phi i32 [ 2, %bb1 ], [ 2, %bb1 ], [ 5, %bb2 ], [ 2, %bb1 ]