llvm.org GIT mirror llvm / ca4b180
Added test for commit r212802 that was missing git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212803 91177308-0d34-0410-b5e6-96231b3b80d8 Marcello Maggioni 5 years ago
1 changed file(s) with 40 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 ; RUN: opt < %s -lowerswitch -S | FileCheck %s
1
2 define i32 @test(i32 %arg) #0 {
3 ; CHECK-LABEL: @test
4 ; CHECK: ;
5 ; CHECK-NEXT: %res.0 = phi i32 [ 1, %NodeBlock ], [ 2, %1 ]
6 ; CHECK-NEXT: br label %3
7 ; CHECK: ;
8 ; CHECK-NEXT: %res.3 = phi i32 [ 0, %NewDefault ], [ %res.2, %4 ]
9 ; CHECK-NEXT: %6 = add nsw i32 %res.3, 1
10 ; CHECK-NEXT: ret i32 %6
11
12 switch i32 %arg, label %5 [
13 i32 1, label %1
14 i32 2, label %2
15 i32 3, label %3
16 i32 4, label %4
17 ]
18
19 ;
20 br label %2
21
22 ;
23 %res.0 = phi i32 [ 1, %0 ], [ 2, %1 ]
24 br label %3
25
26 ;
27 %res.1 = phi i32 [ 0, %0 ], [ %res.0, %2 ]
28 %phitmp = add nsw i32 %res.1, 2
29 br label %4
30
31 ;
32 %res.2 = phi i32 [ 1, %0 ], [ %phitmp, %3 ]
33 br label %5
34
35 ;
36 %res.3 = phi i32 [ 0, %0 ], [ %res.2, %4 ]
37 %6 = add nsw i32 %res.3, 1
38 ret i32 %6
39 }