1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=thumbv7s-apple-ios8.0 -o - %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Workerdeclare void @foo(double) 4*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.arm.space(i32, i32) 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker; The constpool entry used to call @foo should be directly between where we want 7*9880d681SAndroid Build Coastguard Worker; the tbb and its table. Fortunately, the flow is simple enough that we can 8*9880d681SAndroid Build Coastguard Worker; eliminate the entry calculation (ADD) and use the ADR as the base. 9*9880d681SAndroid Build Coastguard Worker; 10*9880d681SAndroid Build Coastguard Worker; I'm hoping this won't be fragile, but if it does break the most likely fix is 11*9880d681SAndroid Build Coastguard Worker; adjusting the @llvm.arm.space call slightly. If this happens too many times 12*9880d681SAndroid Build Coastguard Worker; the test should probably be removed. 13*9880d681SAndroid Build Coastguard Workerdefine i32 @test_jumptable_not_adjacent(i1 %tst, i32 %sw, i32 %l) { 14*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: test_jumptable_not_adjacent: 15*9880d681SAndroid Build Coastguard Worker; CHECK: vldr {{d[0-9]+}}, [[DBL_CONST:LCPI[0-9]+_[0-9]+]] 16*9880d681SAndroid Build Coastguard Worker; [...] 17*9880d681SAndroid Build Coastguard Worker; CHECK: adr.w r[[BASE:[0-9]+]], [[JUMP_TABLE:LJTI[0-9]+_[0-9]+]] 18*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: r[[BASE]] 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; CHECK: [[TBB_KEY:LCPI[0-9]+_[0-9]+]]: 21*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: tbb [r[[BASE]], {{r[0-9]+}}] 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker; CHECK: [[DBL_CONST]]: 24*9880d681SAndroid Build Coastguard Worker; CHECK: .long 25*9880d681SAndroid Build Coastguard Worker; CHECK: .long 26*9880d681SAndroid Build Coastguard Worker; CHECK: [[JUMP_TABLE]]: 27*9880d681SAndroid Build Coastguard Worker; CHECK: .byte (LBB{{[0-9]+}}_{{[0-9]+}}-([[TBB_KEY]]+4) 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker br label %complex 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard Workercomplex: 32*9880d681SAndroid Build Coastguard Worker call void @foo(double 12345.0) 33*9880d681SAndroid Build Coastguard Worker call i32 @llvm.arm.space(i32 970, i32 undef) 34*9880d681SAndroid Build Coastguard Worker switch i32 %sw, label %second [ i32 0, label %other 35*9880d681SAndroid Build Coastguard Worker i32 1, label %third 36*9880d681SAndroid Build Coastguard Worker i32 2, label %end 37*9880d681SAndroid Build Coastguard Worker i32 3, label %other ] 38*9880d681SAndroid Build Coastguard Worker 39*9880d681SAndroid Build Coastguard Workersecond: 40*9880d681SAndroid Build Coastguard Worker ret i32 43 41*9880d681SAndroid Build Coastguard Workerthird: 42*9880d681SAndroid Build Coastguard Worker ret i32 0 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Workerother: 45*9880d681SAndroid Build Coastguard Worker call void @bar() 46*9880d681SAndroid Build Coastguard Worker unreachable 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Workerend: 49*9880d681SAndroid Build Coastguard Worker ret i32 42 50*9880d681SAndroid Build Coastguard Worker} 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Workerdeclare void @bar() 53