[llvm-bugs] [Bug 26325] New: [x86] Consider mov-to-push also at -O2?
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 26 13:10:39 PST 2016
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: unassignedbugs at nondot.org
Reporter: hans at chromium.org
CC: llvm-bugs at lists.llvm.org, michael.kuperstein at gmail.com
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 at Z>:
0: 6a 01 push $0x1
2: ff 74 24 08 pushl 0x8(%esp)
6: e8 00 00 00 00 call b <?g@@YAXH at Z+0xb>
b: 83 c4 08 add $0x8,%esp
e: c3 ret
but with -O2 it generates:
00000000 <?g@@YAXH at 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 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160126/3560162d/attachment.html>
More information about the llvm-bugs
mailing list