This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/41171] register allocator undoing optimal schedule
- From: "bergner at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Aug 2009 20:57:13 -0000
- Subject: [Bug rtl-optimization/41171] register allocator undoing optimal schedule
- References: <bug-41171-12896@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from bergner at gcc dot gnu dot org 2009-08-26 20:57 -------
>From my bug analysis and request for comment on the mailinglist:
http://gcc.gnu.org/ml/gcc/2009-08/msg00485.html
This is caused by update_equiv_regs() which IRA inherited from local-alloc.c.
Although with gcc 4.3 and earlier, you don't see the problem, it is still
there,
because if you look at the 4.3 dumps, you will see that update_equiv_regs()
unordered them for us. What is saving us is that sched2 reschedules them
again for us in the order we want. With 4.4, IRA happens to reuse the same
register for both pseudos, so sched2 is hand tied and cannot schedule them
back again for us.
Looking at update_equiv_regs(), if I disable the replacement for regs
that are local to one basic block (patch below) like it existed before
John Wehle's patch way back in Oct 2000:
http://gcc.gnu.org/ml/gcc-patches/2000-09/msg00782.html
then we get the ordering we want. Does anyone know why John removed
that part of the test in his patch? Thoughts anyone?
Peter
Index: ira.c
===================================================================
--- ira.c (revision 151111)
+++ ira.c (working copy)
@@ -2510,6 +2510,7 @@ update_equiv_regs (void)
calls. */
if (REG_N_REFS (regno) == 2
+ && REG_BASIC_BLOCK (regno) < NUM_FIXED_BLOCKS
&& (rtx_equal_p (x, src)
|| ! equiv_init_varies_p (src))
&& NONJUMP_INSN_P (insn)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41171