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

            Bug ID: 26325
           Summary: [x86] Consider mov-to-push also at -O2?
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
            Blocks: 26299
    Classification: Unclassified

On Windows, most of Chromium builds with /O1 /Os (optimize for size), but some
of it builds with /O2 /Ot (optimize for speed).

For this code:

  void f(int x, int y);
  void g(int x) {
    f(x, 1);
  }

clang -target i686-pc-win32 -Os generates:

00000000 <?g@@YAXH@Z>:
   0:    6a 01                    push   $0x1
   2:    ff 74 24 08              pushl  0x8(%esp)
   6:    e8 00 00 00 00           call   b <?g@@YAXH@Z+0xb>
   b:    83 c4 08                 add    $0x8,%esp
   e:    c3                      ret

but with -O2 it generates:

00000000 <?g@@YAXH@Z>:
   0:    83 ec 08                 sub    $0x8,%esp
   3:    8b 44 24 0c              mov    0xc(%esp),%eax
   7:    89 04 24                 mov    %eax,(%esp)
   a:    c7 44 24 04 01 00 00     movl   $0x1,0x4(%esp)
  11:    00 
  12:    e8 00 00 00 00           call   17 <?g@@YAXH@Z+0x17>
  17:    83 c4 08                 add    $0x8,%esp
  1a:    c3                      ret


Is the -O2 version actually faster enough to justify the size increase here?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to