<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 --- - [x86] Consider mov-to-push also at -O2?"
   href="https://llvm.org/bugs/show_bug.cgi?id=26325">26325</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[x86] Consider mov-to-push also at -O2?
          </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>Linux
          </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>Backend: X86
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>hans@chromium.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, michael.kuperstein@gmail.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>26299
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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?</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>