Replace PROLOG_LABEL with a new CFI_INSTRUCTION.
[oota-llvm.git] / test / CodeGen / ARM / indirectbr-2.ll
1 ; RUN: llc < %s -O0 -relocation-model=pic -mtriple=thumbv7-apple-ios | FileCheck %s
2 ; <rdar://problem/12529625>
3
4 @foo = global i32 34879, align 4
5 @DWJumpTable2808 = global [2 x i32] [i32 sub (i32 ptrtoint (i8* blockaddress(@func, %14) to i32), i32 ptrtoint (i8* blockaddress(@func, %4) to i32)), i32 sub (i32 ptrtoint (i8* blockaddress(@func, %13) to i32), i32 ptrtoint (i8* blockaddress(@func, %4) to i32))]
6 @0 = internal constant [45 x i8] c"func XXXXXXXXXXX :: bb xxxxxxxxxxxxxxxxxxxx\0A\00"
7
8 ; The indirect branch has the two destinations as successors. The lone PHI
9 ; statement shouldn't be implicitly defined.
10
11 ; CHECK-LABEL:      func:
12 ; CHECK:      Ltmp1:    @ Block address taken
13 ; CHECK-NOT:            @ implicit-def: R0
14 ; CHECK:                @ 4-byte Reload
15
16 define i32 @func() nounwind ssp {
17   %1 = alloca i32, align 4
18   %2 = load i32* @foo, align 4
19   %3 = icmp eq i32 %2, 34879
20   br label %4
21
22 ; <label>:4                                       ; preds = %0
23   %5 = zext i1 %3 to i32
24   %6 = mul i32 %5, 287
25   %7 = add i32 %6, 2
26   %8 = getelementptr [2 x i32]* @DWJumpTable2808, i32 0, i32 %5
27   %9 = load i32* %8
28   %10 = add i32 %9, ptrtoint (i8* blockaddress(@func, %4) to i32)
29   %11 = inttoptr i32 %10 to i8*
30   %12 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([45 x i8]* @0, i32 0, i32 0))
31   indirectbr i8* %11, [label %13, label %14]
32
33 ; <label>:13                                      ; preds = %4
34   %tmp14 = phi i32 [ %7, %4 ]
35   store i32 23958, i32* @foo, align 4
36   %tmp15 = load i32* %1, align 4
37   %tmp16 = icmp eq i32 %tmp15, 0
38   %tmp17 = zext i1 %tmp16 to i32
39   %tmp21 = add i32 %tmp17, %tmp14
40   ret i32 %tmp21
41
42 ; <label>:14                                      ; preds = %4
43   ret i32 42
44 }
45
46 declare i32 @printf(i8*, ...)