Bill Wendling | 12cda50 | 2012-10-22 23:30:04 +0000 | [diff] [blame] | 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 | |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 11 | ; CHECK-LABEL: func: |
Rafael Espindola | b1f25f1 | 2014-03-07 06:08:31 +0000 | [diff] [blame] | 12 | ; CHECK: Ltmp1: @ Block address taken |
Bill Wendling | 12cda50 | 2012-10-22 23:30:04 +0000 | [diff] [blame] | 13 | ; CHECK-NOT: @ implicit-def: R0 |
| 14 | ; CHECK: @ 4-byte Reload |
| 15 | |
| 16 | define i32 @func() nounwind ssp { |
| 17 | %1 = alloca i32, align 4 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 18 | %2 = load i32, i32* @foo, align 4 |
Bill Wendling | 12cda50 | 2012-10-22 23:30:04 +0000 | [diff] [blame] | 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 |
David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 26 | %8 = getelementptr [2 x i32], [2 x i32]* @DWJumpTable2808, i32 0, i32 %5 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 27 | %9 = load i32, i32* %8 |
Bill Wendling | 12cda50 | 2012-10-22 23:30:04 +0000 | [diff] [blame] | 28 | %10 = add i32 %9, ptrtoint (i8* blockaddress(@func, %4) to i32) |
| 29 | %11 = inttoptr i32 %10 to i8* |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 30 | %12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @0, i32 0, i32 0)) |
Bill Wendling | 12cda50 | 2012-10-22 23:30:04 +0000 | [diff] [blame] | 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 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 36 | %tmp15 = load i32, i32* %1, align 4 |
Bill Wendling | 12cda50 | 2012-10-22 23:30:04 +0000 | [diff] [blame] | 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*, ...) |