[llvm-bugs] [Bug 47625] New: Extra spilli/reload around function call

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Sep 23 04:19:17 PDT 2020


            Bug ID: 47625
           Summary: Extra spilli/reload around function call
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: david.bolvansky at gmail.com
                CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
                    llvm-dev at redking.me.uk, spatel+llvm at rotateright.com

double a[8], b[8];
int x;

void __attribute__((noinline))
bar (void)
  x = 1;

void __attribute__((noinline))
foo(int i)
  double t1 = a[i];
  bar ();
  b[i] = 2*t1;

CLang -O3:
bar():                                # @bar()
        mov     dword ptr [rip + x], 1
foo(int):                                # @foo(int)
        push    rbx
        sub     rsp, 16
        movsxd  rbx, edi
        movsd   xmm0, qword ptr [8*rbx + a]     # xmm0 = mem[0],zero
        movsd   qword ptr [rsp + 8], xmm0       # 8-byte Spill
        call    bar()
        movsd   xmm0, qword ptr [rsp + 8]       # 8-byte Reload
        addsd   xmm0, xmm0
        movsd   qword ptr [8*rbx + b], xmm0
        add     rsp, 16
        pop     rbx

GCC -O3:
        mov     DWORD PTR x[rip], 1
        movsx   rdi, edi
        movsd   xmm0, QWORD PTR a[0+rdi*8]
        call    bar()
        addsd   xmm0, xmm0
        movsd   QWORD PTR b[0+rdi*8], xmm0


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/20200923/d24b262f/attachment.html>

More information about the llvm-bugs mailing list