[llvm-bugs] [Bug 39170] New: [AArch64] redundant adrp/ldr on aarch64 (GCC does better)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Oct 3 17:23:07 PDT 2018


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

            Bug ID: 39170
           Summary: [AArch64] redundant adrp/ldr on aarch64 (GCC does
                    better)
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: kcc at google.com
                CC: llvm-bugs at lists.llvm.org

clang version 8.0.0 (trunk 343550)

typedef struct {
  long a, b;
} S;
void foo(S *s) {
  s->a = 1;
  s->b = 0;
}

clang++ -fomit-frame-pointer  -O3  -S -o - store16.c -target aarch64-linux

        adrp    x8, .LCPI0_0                <<<<<<<<<<<<
        ldr     q0, [x8, :lo12:.LCPI0_0]    <<<<<<<<<<<<
        str     q0, [x0]
        ret

While gcc 6.3 does this (much nicer!!): 
        mov     x1, 1           
        stp     x1, xzr, [x0]
        ret


If I change "s->b = 0" to "s->b = 1" clang generates the same code
(loads the constant)

but gcc keeps avoiding loads (still better!!)
        mov     x2, 1
        mov     x1, 2
        stp     x2, x1, [x0]
        ret

-- 
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/20181004/02850a36/attachment.html>


More information about the llvm-bugs mailing list