[llvm-dev] Recent -Os code size regressions
Steve King via llvm-dev
llvm-dev at lists.llvm.org
Fri Nov 20 17:15:53 PST 2015
On Fri, Nov 20, 2015 at 5:06 PM, James Molloy <james at jamesmolloy.co.uk>
wrote:
>
> Hi,
>
> We'd need to look precisely at what's causing the code size bloat. The
midend commit pointed out by Steve shouldn't cause bloat in and of itself -
it should reduce code size. It removes a load of stores and branches.
>
> I know a backend change I made to ARM isn't behaving as well as it could,
and I have patches to fix that. Speculatively reverting midend patches
isn't the best way to approach this, in my opinion! :)
>
For i586, the effect of r252152 seems to cause cmoves instead of branches.
Code size increase is +35% for i586.
Unfortunately the object files are wildly different in a way that does not
seem to occur in other workloads. I tried to clip a concise before and
after case.
Before
:
As a reference point, I found OR $0x408 and OR $0x810 in close proximity.
278: 81 ca 10 08 00 00 or $0x810,%edx
27e: 89 10 mov %edx,(%eax)
280: f6 c1 40
test $0x40,%cl
283: 74 08 je 28d <t_run_test+0x28d>
285: 81 ca 08 04 00 00 or $0x408,%edx
28b: 89 10 mov %edx,(%eax)
28d: 84 c9 test %cl,%cl
28f: 0f 89 34 01 00 00 jns 3c9 <t_run_test+0x3c9>
After
r252152:
Note that the OR $0x408 and OR $0x810 come
now
in reverse order.
35d: 81 c9 08 04 00 00 or $0x408,%ecx
363: 89 4c 24 28 mov %ecx,0x28(%esp)
367: 89 df mov %ebx,%edi
369: 83 e7 10
and $0x10,%edi
36c: 89 7c 24 20 mov %edi,0x20(%esp)
370: 0f 45 d1
cmovne %ecx,%edx
373: 89 d7 mov %edx,%edi
375: 81 cf 10 08 00 00 or $0x810,%edi
37b: 89 7c 24 14 mov %edi,0x14(%esp)
37f: 89 d9 mov %ebx,%ecx
381: 83 e1 20
and $0x20,%ecx
384: 89 4c 24 1c mov %ecx,0x1c(%esp)
388: 0f 45 d7
cmovne %edi,%edx
38b: 89 d7 mov %edx,%edi
HTH,
-steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151120/e41234db/attachment-0001.html>
More information about the llvm-dev
mailing list