41 lines · plain
1; RUN: opt < %s -passes=lower-switch -S | FileCheck %s2 3define i32 @test(i32 %arg) #0 {4; CHECK-LABEL: @test5; CHECK: 2:6; CHECK-NEXT: %res.0 = phi i32 [ 1, %NodeBlock ], [ 2, %1 ]7; CHECK-NEXT: br label %38; CHECK: 5:9; CHECK-NEXT: %res.3 = phi i32 [ %res.2, %4 ], [ 0, %LeafBlock ], [ 0, %LeafBlock1 ]10; CHECK-NEXT: %6 = add nsw i32 %res.3, 111; CHECK-NEXT: ret i32 %612 13 switch i32 %arg, label %5 [14 i32 1, label %115 i32 2, label %216 i32 3, label %317 i32 4, label %418 ]19 201:21 br label %222 232:24 %res.0 = phi i32 [ 1, %0 ], [ 2, %1 ]25 br label %326 273:28 %res.1 = phi i32 [ 0, %0 ], [ %res.0, %2 ]29 %phitmp = add nsw i32 %res.1, 230 br label %431 324:33 %res.2 = phi i32 [ 1, %0 ], [ %phitmp, %3 ]34 br label %535 365:37 %res.3 = phi i32 [ 0, %0 ], [ %res.2, %4 ]38 %6 = add nsw i32 %res.3, 139 ret i32 %640}41