[llvm-bugs] [Bug 28542] New: X86CallFrameOptimization leads to generation of two consecutive `subl $8, %esp` (instead of a single `subl $16, %esp)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jul 13 12:46:26 PDT 2016


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

            Bug ID: 28542
           Summary: X86CallFrameOptimization leads to generation of two
                    consecutive `subl $8, %esp` (instead of a single `subl
                    $16, %esp)
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ cat fastisel.cc 
struct S {
  void f(int a);
};
void g() {
  S s;
  s.f(43);
}
$ bin/clang -m32 -O2 -c fastisel.cc -S  -o - -mllvm -no-x86-call-frame-opt
...
    pushl    %ebp
    movl    %esp, %ebp
    subl    $24, %esp
    leal    -8(%ebp), %eax
    movl    %eax, (%esp)
    movl    $43, 4(%esp)
    calll    __ZN1S1fEi
...

This looks reasonable. Now:

$ bin/clang -m32 -O2 -c fastisel.cc -S  -o - 
...
    pushl    %ebp
    movl    %esp, %ebp
    subl    $8, %esp
    subl    $8, %esp
    leal    -8(%ebp), %eax
    pushl    $43
    pushl    %eax
    calll    __ZN1S1fEi

This would look much better if it said `subl $16, %esp` instead.

-- 
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/20160713/335e1dd5/attachment.html>


More information about the llvm-bugs mailing list