<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Call frame optimization fails for immediate arguments of 0 or -1"
   href="https://bugs.llvm.org/show_bug.cgi?id=34863">34863</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Call frame optimization fails for immediate arguments of 0 or -1
          </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>Windows NT
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.l.kreitzer@intel.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The X86CallFrameOptimization fails to recognize outgoing parameter stores of 0,
-1 that are implemented using AND, OR. So we are missing out on some
opportunities to use PUSH instead of MOV.

bash-4.2$ cat t.ll

declare void @f2(i32, i32, i32, i32, i32, i32, i32, i32)
define void @f1(i32 %x) minsize nounwind {
entry:
  tail call void @f2(i32 %x, i32 %x, i32 %x, i32 %x, i32 %x, i32 %x, i32 0, i32
-1) #2
  ret void
}

bash-4.2$ llc -mtriple=i686-unknown-unknown t.ll -o -

        .text
        .file   "t.ll"
        .globl  f1                      # -- Begin function f1
        .p2align        4, 0x90
        .type   f1,@function
f1:                                     # @f1
# BB#0:                                 # %entry
        subl    $32, %esp
        movl    36(%esp), %eax
        movl    %eax, 20(%esp)
        movl    %eax, 16(%esp)
        movl    %eax, 12(%esp)
        movl    %eax, 8(%esp)
        movl    %eax, 4(%esp)
        movl    %eax, (%esp)
        orl     $-1, 28(%esp)
        andl    $0, 24(%esp)
        calll   f2
        addl    $32, %esp
        retl
.Lfunc_end0:
        .size   f1, .Lfunc_end0-f1
                                        # -- End function

        .section        ".note.GNU-stack","",@progbits

bash-4.2$ llc -mtriple=x86_64-unknown-unknown t.ll -o -

        .text
        .file   "t.ll"
        .globl  f1                      # -- Begin function f1
        .p2align        4, 0x90
        .type   f1,@function
f1:                                     # @f1
# BB#0:                                 # %entry
        subq    $24, %rsp
        orl     $-1, 8(%rsp)
        andl    $0, (%rsp)
        movl    %edi, %esi
        movl    %edi, %edx
        movl    %edi, %ecx
        movl    %edi, %r8d
        movl    %edi, %r9d
        callq   f2
        addq    $24, %rsp
        retq
.Lfunc_end0:
        .size   f1, .Lfunc_end0-f1
                                        # -- End function

        .section        ".note.GNU-stack","",@progbits</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>