<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Unused stackslots generated in reg spills"
   href="https://llvm.org/bugs/show_bug.cgi?id=26374">26374</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Unused stackslots generated in reg spills
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Register Allocator
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>wmi@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=15754" name="attach_15754" title="testcase 1.c">attachment 15754</a> <a href="attachment.cgi?id=15754&action=edit" title="testcase 1.c">[details]</a></span>
testcase 1.c

The problem was originally described in
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - llvm missing opportunities to overlap non-interfering local variables"
   href="show_bug.cgi?id=25776">https://llvm.org/bugs/show_bug.cgi?id=25776</a> #<a href="show_bug.cgi?id=26374#c3">comment3</a>. 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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>