[llvm-bugs] [Bug 26333] New: [x86] Use pop to restore stack instead of add
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 26 15:35:17 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26333
Bug ID: 26333
Summary: [x86] Use pop to restore stack instead of add
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
Blocks: 26299
Classification: Unclassified
Consider the following at -Os:
struct S {
void foo();
};
S *bar(int);
void baz() {
bar(0)->foo();
}
Clang will generate:
00000000 <?baz@@YAXXZ>:
0: 6a 00 push $0x0
2: e8 00 00 00 00 call 7 <?baz@@YAXXZ+0x7>
7: 83 c4 04 add $0x4,%esp
a: 89 c1 mov %eax,%ecx
c: e9 00 00 00 00 jmp 11 <@feat.00+0x10>
Instead of 'add $0x4,%esp', MSVC would do 'pop %ecx' and save two bytes,
because %ecx isn't live there anyway.
This incurs a memory access, but since nothing depends on the result, maybe
that would be OK, at least at -Os?
--
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/691c4ebf/attachment.html>
More information about the llvm-bugs
mailing list