1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; PR35221. Test that external global address is not reloaded from GOT in each BB.
3 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -relocation-model=pic | FileCheck %s -check-prefix=LINUX-PIC
5 @x = external global i8, align 1
7 define signext i8 @foo() {
8 ; LINUX-PIC-LABEL: foo:
9 ; LINUX-PIC: @ %bb.0: @ %entry
10 ; LINUX-PIC-NEXT: .save {r4, lr}
11 ; LINUX-PIC-NEXT: push {r4, lr}
12 ; LINUX-PIC-NEXT: ldr r4, .LCPI0_0
13 ; LINUX-PIC-NEXT: mov r0, #0
14 ; LINUX-PIC-NEXT: .LPC0_0:
15 ; LINUX-PIC-NEXT: ldr r4, [pc, r4]
16 ; LINUX-PIC-NEXT: ldrb r1, [r4]
17 ; LINUX-PIC-NEXT: cmp r1, #0
18 ; LINUX-PIC-NEXT: beq .LBB0_2
19 ; LINUX-PIC-NEXT: @ %bb.1: @ %common.ret
20 ; LINUX-PIC-NEXT: sxtb r0, r0
21 ; LINUX-PIC-NEXT: pop {r4, pc}
22 ; LINUX-PIC-NEXT: .LBB0_2: @ %bb1
23 ; LINUX-PIC-NEXT: bl bar
24 ; LINUX-PIC-NEXT: ldrb r0, [r4]
25 ; LINUX-PIC-NEXT: sxtb r0, r0
26 ; LINUX-PIC-NEXT: pop {r4, pc}
27 ; LINUX-PIC-NEXT: .p2align 2
28 ; LINUX-PIC-NEXT: @ %bb.3:
29 ; LINUX-PIC-NEXT: .LCPI0_0:
30 ; LINUX-PIC-NEXT: .Ltmp0:
31 ; LINUX-PIC-NEXT: .long x(GOT_PREL)-((.LPC0_0+8)-.Ltmp0)
34 %tobool = icmp eq i8 %0, 0
35 br i1 %tobool, label %bb1, label %bb2
39 ; No more pc-relative loads! Reuse r[[B]].