1 ; RUN: llc < %s -mtriple=thumbv7-apple-darwin -relocation-model=pic | FileCheck %s 2 3 ; Thumb2 target should reorder the bb's in order to use tbb / tbh. 4 5 %struct.R_flstr = type { i32, i32, i8* } 6 %struct._T_tstr = type { i32, %struct.R_flstr*, %struct._T_tstr* } 7 @_C_nextcmd = external global i32 ; <i32*> [#uses=3] 8 @.str31 = external constant [28 x i8], align 1 ; <[28 x i8]*> [#uses=1] 9 @_T_gtol = external global %struct._T_tstr* ; <%struct._T_tstr**> [#uses=2] 10 11 declare i32 @strlen(i8* nocapture) nounwind readonly 12 13 declare void @Z_fatal(i8*) noreturn nounwind 14 15 declare noalias i8* @calloc(i32, i32) nounwind 16 17 ; Jump tables are not anchored next to the TBB/TBH any more. Make sure the 18 ; correct address is still calculated (i.e. via a PC-relative symbol *at* the 19 ; TBB/TBH). 20 define i32 @main(i32 %argc, i8** nocapture %argv) nounwind { 21 ; CHECK-LABEL: main: 22 ; CHECK-NOT: adr {{r[0-9]+}}, LJTI 23 ; CHECK: [[PCREL_ANCHOR:LCPI[0-9]+_[0-9]+]]: 24 ; CHECK-NEXT: tbb [pc, {{r[0-9]+}}] 25 26 ; CHECK: LJTI0_0: 27 ; CHECK-NEXT: .data_region jt8 28 ; CHECK-NEXT: .byte (LBB{{[0-9]+_[0-9]+}}-([[PCREL_ANCHOR]]+4))/2 29 30 entry: 31 br label %bb42.i 32 33 bb1.i2: ; preds = %bb42.i 34 br label %bb40.i 35 36 bb5.i: ; preds = %bb42.i 37 %0 = or i32 %argc, 32 ; <i32> [#uses=1] 38 br label %bb40.i 39 40 bb7.i: ; preds = %bb42.i 41 call void @_T_addtol(%struct._T_tstr** @_T_gtol, i32 0, i8* null) nounwind 42 unreachable 43 44 bb15.i: ; preds = %bb42.i 45 call void @_T_addtol(%struct._T_tstr** @_T_gtol, i32 2, i8* null) nounwind 46 unreachable 47 48 bb23.i: ; preds = %bb42.i 49 %1 = call i32 @strlen(i8* null) nounwind readonly ; <i32> [#uses=0] 50 unreachable 51 52 bb33.i: ; preds = %bb42.i 53 store i32 0, i32* @_C_nextcmd, align 4 54 %2 = call noalias i8* @calloc(i32 21, i32 1) nounwind ; <i8*> [#uses=0] 55 unreachable 56 57 bb34.i: ; preds = %bb42.i 58 %3 = load i32, i32* @_C_nextcmd, align 4 ; <i32> [#uses=1] 59 %4 = add i32 %3, 1 ; <i32> [#uses=1] 60 store i32 %4, i32* @_C_nextcmd, align 4 61 %5 = call noalias i8* @calloc(i32 22, i32 1) nounwind ; <i8*> [#uses=0] 62 unreachable 63 64 bb35.i: ; preds = %bb42.i 65 %6 = call noalias i8* @calloc(i32 20, i32 1) nounwind ; <i8*> [#uses=0] 66 unreachable 67 68 bb37.i: ; preds = %bb42.i 69 %7 = call noalias i8* @calloc(i32 14, i32 1) nounwind ; <i8*> [#uses=0] 70 unreachable 71 72 bb39.i: ; preds = %bb42.i 73 call void @Z_fatal(i8* getelementptr ([28 x i8], [28 x i8]* @.str31, i32 0, i32 0)) nounwind 74 unreachable 75 76 bb40.i: ; preds = %bb42.i, %bb5.i, %bb1.i2 77 br label %bb42.i 78 79 bb42.i: ; preds = %bb40.i, %entry 80 switch i32 %argc, label %bb39.i [ 81 i32 67, label %bb33.i 82 i32 70, label %bb35.i 83 i32 77, label %bb37.i 84 i32 83, label %bb34.i 85 i32 97, label %bb7.i 86 i32 100, label %bb5.i 87 i32 101, label %bb40.i 88 i32 102, label %bb23.i 89 i32 105, label %bb15.i 90 i32 116, label %bb1.i2 91 ] 92 } 93 94 declare void @_T_addtol(%struct._T_tstr** nocapture, i32, i8*) nounwind 95