• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llvm-as < %s | llvm-dis > %t1.ll
2; RUN: llvm-as %t1.ll -o - | llvm-dis > %t2.ll
3; RUN: diff %t1.ll %t2.ll
4
5        %int = type i32
6
7define i32 @squared(i32 %i0) {
8        switch i32 %i0, label %Default [
9                 i32 1, label %Case1
10                 i32 2, label %Case2
11                 i32 4, label %Case4
12        ]
13
14Default:                ; preds = %0
15        ret i32 -1
16
17Case1:          ; preds = %0
18        ret i32 1
19
20Case2:          ; preds = %0
21        ret i32 4
22
23Case4:          ; preds = %0
24        ret i32 16
25}
26
27
28@Addr = global i8* blockaddress(@indbrtest, %BB1)
29@Addr3 = global i8* blockaddress(@squared, %Case1)
30
31
32define i32 @indbrtest(i8* %P, i32* %Q) {
33  indirectbr i8* %P, [label %BB1, label %BB2, label %BB3]
34BB1:
35  indirectbr i32* %Q, []
36BB2:
37  %R = bitcast i8* blockaddress(@indbrtest, %BB3) to i8*
38  indirectbr i8* %R, [label %BB1, label %BB2, label %BB3]
39BB3:
40  ret i32 2
41}
42
43
44