[llvm-bugs] [Bug 35221] New: [ARM] Unnecessary reloads from GOT

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 6 18:27:12 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35221

            Bug ID: 35221
           Summary: [ARM] Unnecessary reloads from GOT
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: eugeni.stepanov at gmail.com
                CC: llvm-bugs at lists.llvm.org

ARM backend fails to reuse the address of an external variable between basic
blocks and reloads it from GOT on each use.

# cat 1.c
extern char x;
void fail();
void f() {
  if (x) fail();
  if (x) fail();
  if (x) fail();
}


# clang 1.c -O3 -target arm-linux-androideabi -c && objdump -drl 1.o
f():
   0:   e92d4800        push    {fp, lr}
   4:   e1a0b00d        mov     fp, sp
   8:   e59f004c        ldr     r0, [pc, #76]   ; 5c <f+0x5c>
   c:   e79f0000        ldr     r0, [pc, r0]
  10:   e5d00000        ldrb    r0, [r0]
  14:   e3500000        cmp     r0, #0
  18:   0a00000d        beq     54 <f+0x54>
  1c:   ebfffffe        bl      0 <fail>
                        1c: R_ARM_CALL  fail
  20:   e59f0038        ldr     r0, [pc, #56]   ; 60 <f+0x60>
  24:   e79f0000        ldr     r0, [pc, r0]
  28:   e5d00000        ldrb    r0, [r0]
  2c:   e3500000        cmp     r0, #0
  30:   0a000007        beq     54 <f+0x54>
  34:   ebfffffe        bl      0 <fail>
                        34: R_ARM_CALL  fail
  38:   e59f0024        ldr     r0, [pc, #36]   ; 64 <f+0x64>
  3c:   e79f0000        ldr     r0, [pc, r0]
  40:   e5d00000        ldrb    r0, [r0]
  44:   e3500000        cmp     r0, #0
  48:   0a000001        beq     54 <f+0x54>
  4c:   e8bd4800        pop     {fp, lr}
  50:   eafffffe        b       0 <fail>
                        50: R_ARM_JUMP24        fail
  54:   e8bd4800        pop     {fp, lr}
  58:   e12fff1e        bx      lr
  5c:   00000048        .word   0x00000048
                        5c: R_ARM_GOT_PREL      x
  60:   00000034        .word   0x00000034
                        60: R_ARM_GOT_PREL      x
  64:   00000020        .word   0x00000020
                        64: R_ARM_GOT_PREL      x

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171107/c74249d9/attachment.html>


More information about the llvm-bugs mailing list