This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/57046] [4.8/4.9 Regression] wrong code generated by gcc 4.8.0 on i686
- From: "vmakarov at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 23 Apr 2013 15:34:40 +0000
- Subject: [Bug rtl-optimization/57046] [4.8/4.9 Regression] wrong code generated by gcc 4.8.0 on i686
- Auto-submitted: auto-generated
- References: <bug-57046-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57046
Vladimir Makarov <vmakarov at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |vmakarov at redhat dot com
--- Comment #5 from Vladimir Makarov <vmakarov at redhat dot com> 2013-04-23 15:34:40 UTC ---
(In reply to comment #4)
> We have after the get_value call:
> (insn 73 30 32 6 (set (reg:SI 76 [ D.1441 ])
> (reg:SI 0 ax)) pr57046.c:42 85 {*movsi_internal}
> (expr_list:REG_DEAD (reg:SI 0 ax)
> (nil)))
> (insn 32 73 33 6 (parallel [
> (set (reg:SI 73 [ D.1443 ])
> (ashift:SI (subreg:SI (reg:DI 60 [ D.1441 ]) 0)
> (const_int 2 [0x2])))
> (clobber (reg:CC 17 flags))
> ]) 502 {*ashlsi3_1}
> (expr_list:REG_DEAD (reg:DI 60 [ D.1441 ])
> (expr_list:REG_UNUSED (reg:CC 17 flags)
> (nil))))
>
> and IRA decides to put pseudo 76 into %ebx and pseudo 60 into %ecx. Either it
> is an IRA bug, or IRA takes into account that we only really need the low
> 32-bits of pseudo 60 at that point. In any case, reload loads SImode %ecx from
> the stack and uses it in the shift, while LRA loads full DImode %ecx (i.e. %ecx
> and %ebx) from the stack, then uses just the low bits from that (i.e. %ecx) in
> the shift. So the LRA generated code clobbers the value in %ebx, and get_value
> call is even later on DCEd because of it.
It seems like a discrepancy in IRA which allocates in terms of subregisters and
LRA splitting (including call save/restore as in this case) in terms of
pseudos. I guess fixing this might take about week.