Home | History | Annotate | Download | only in ARM
      1 ; PR35221. Test that external global address is not reloaded from GOT in each BB.
      2 ; RUN: llc < %s -mtriple=armv7-linux-gnueabi -relocation-model=pic | FileCheck %s -check-prefix=LINUX-PIC
      3 
      4 @x = external global i8, align 1
      5 
      6 define signext i8 @foo() {
      7 entry:
      8 ; LINUX-PIC:     ldr	r[[A:.]], .LCPI0_0
      9 ; LINUX-PIC:     ldr	r[[B:.]], [pc, r[[A]]]
     10 ; LINUX-PIC:     ldrb	r{{.}}, [r[[B]]]
     11   %0 = load i8, i8* @x
     12   %tobool = icmp eq i8 %0, 0
     13   br i1 %tobool, label %bb1, label %bb2
     14 
     15 bb1:
     16   call void @bar()
     17 ; No more pc-relative loads! Reuse r[[B]].
     18 ; LINUX-PIC:     bl	bar
     19 ; LINUX-PIC-NOT: ldr{{.*}}[pc,
     20 ; LINUX-PIC:     ldrsb	r{{.}}, [r[[B]]]
     21   %1 = load i8, i8* @x
     22   ret i8 %1
     23 
     24 bb2:
     25   ret i8 0
     26 }
     27 
     28 declare void @bar()
     29 
     30 
     31