[llvm-bugs] [Bug 34863] New: Call frame optimization fails for immediate arguments of 0 or -1

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 6 11:27:43 PDT 2017


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

            Bug ID: 34863
           Summary: Call frame optimization fails for immediate arguments
                    of 0 or -1
           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.l.kreitzer at intel.com
                CC: llvm-bugs at lists.llvm.org

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, at 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","", at 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, at 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","", at progbits

-- 
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/20171006/0c809da4/attachment.html>


More information about the llvm-bugs mailing list