[llvm-bugs] [Bug 26374] New: Unused stackslots generated in reg spills

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 29 11:06:48 PST 2016


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

            Bug ID: 26374
           Summary: Unused stackslots generated in reg spills
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Register Allocator
          Assignee: unassignedbugs at nondot.org
          Reporter: wmi at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15754
  --> https://llvm.org/bugs/attachment.cgi?id=15754&action=edit
testcase 1.c

The problem was originally described in
https://llvm.org/bugs/show_bug.cgi?id=25776 #comment3. Reposted it here to give
it a separate bug number so the testcase of the patch to fix it can use the
number.

$ ~/workarea/llvm-r254800/build/bin/clang -O2 -S 1.c
$ grep 'rsp' 1.s
    subq    $408, %rsp              # imm = 0x198
    movl    $0, 124(%rsp)           # 4-byte Folded Spill
    movq    %rdx, 72(%rsp)          # 8-byte Spill
    movq    %rax, 128(%rsp)         # 8-byte Spill
    movq    %rax, 88(%rsp)          # 8-byte Spill
    movq    %rdx, 96(%rsp)          # 8-byte Spill
    movq    %rcx, 80(%rsp)          # 8-byte Spill
    leaq    240(%rsp), %r15
    movq    %r15, 104(%rsp)         # 8-byte Spill
    movq    %r14, 112(%rsp)         # 8-byte Spill
    movq    %rsi, 136(%rsp)         # 8-byte Spill
    movq    96(%rsp), %rcx          # 8-byte Reload
    movq    80(%rsp), %r13          # 8-byte Reload
    movl    $0, (%rsp)
    addl    %eax, 124(%rsp)         # 4-byte Folded Spill
    movq    136(%rsp), %rsi         # 8-byte Reload
    cmpq    128(%rsp), %r13         # 8-byte Folded Reload
    movq    112(%rsp), %r14         # 8-byte Reload
    movq    104(%rsp), %r15         # 8-byte Reload
    cmpq    88(%rsp), %rsi          # 8-byte Folded Reload
    movaps    144(%rsp), %xmm0
    movaps    160(%rsp), %xmm1
    leaq    176(%rsp), %rax
    leaq    208(%rsp), %rax
    leaq    240(%rsp), %rax
    leaq    272(%rsp), %rax
    leaq    304(%rsp), %rax
    leaq    336(%rsp), %rax
    leaq    368(%rsp), %rax
    addl    %eax, 124(%rsp)         # 4-byte Folded Spill
    movq    72(%rsp), %rdx          # 8-byte Reload
    movl    124(%rsp), %eax         # 4-byte Reload
    addq    $408, %rsp              # imm = 0x198

88(%rsp) and 96(%rsp) are both used as Spill stack slots above. 90(%rsp) is a
hole which is never used.

A part of -debug-only=regalloc dump result: 
********** REGISTER MAP **********
[%vreg0 -> fi#1] GR64
[%vreg1 -> fi#2] GR64
[%vreg2 -> fi#3] GR64
[%vreg3 -> fi#4] GR64
[%vreg4 -> fi#5] GR64
...

fi#1,fi#2,fi#3,fi#4,fi#5 have no references in the IR, which means there will
be a lot of unused holes in the stack allocated.

-- 
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/20160129/18f5b68f/attachment-0001.html>


More information about the llvm-bugs mailing list