This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [patch] Remove unused crossjump code


Hi Steven,

You mention you already have a patch that tackles pre-reload
cross-jumping. Is this ready enough to be trialed?

Would this help with PR30905?

Regards,
Rahul

-----Original Message-----
From: gcc-patches-owner@gcc.gnu.org
[mailto:gcc-patches-owner@gcc.gnu.org]
On Behalf Of Steven Bosscher
Sent: 13 June 2009 00:01
To: GCC Patches; Jeff Law
Subject: [patch] Remove unused crossjump code

Hi,

Apparently GCC ran crossjumping before reload once, and it was useful
to substitute REG_EQUIV values for registers because it "helps take
care of G++ cleanups."

There are several problems with this code now:

1. It does not run.  Crossjumping only runs after reload right now
(before reload, crossjumping almost always fails because structurally
equivalent code looks different because different input registers are
used -- I have a patch to deal with that separately).

2. It does not help. As far as I know, GCC currently only has
REG_EQUIV notes for incoming arguments, and the arguments registers
don't overlap so substituting them can never result in a new
successful match. And a failure to substitute a REG_EQUAL note earlier
in the pipeline would mean there is a missed optimization somewhere.
(Cases with different insns but the same REG_EQUAL value are not
handled at all.)

3. I could not figure out what it may have been helpful for in the
past.  The code comes from the old crossjumping code in jump.c so it
predates even the CFG-based crossjumping code. And in jump.c the code
is already in the oldest available revision in SVN. So basically the
code has always been there but its raison-d'etre is lost...  Maybe
some (hi Jeff!) remembers what this was for?

4. The code as-is modifies the insns stream in a _p function. Bad.

Anyway, enough reasons for me to propose this patch, to just remove the
code.
Bootstrapped&tested on {ia64,x86_64}-unknown-linux-gnu and
cross-built&tested on x86_64 X arm-elf, x86_64 X mips-elf.

Ciao!
Steven


* cfgcleanup.c (old_insns_match_p): Remove code to substitute
REG_EQUAL/REG_EQUIV notes.

Index: cfgcleanup.c
===================================================================
--- cfgcleanup.c	(revision 148444)
+++ cfgcleanup.c	(working copy)
@@ -1009,40 +1009,6 @@ old_insns_match_p (int mode ATTRIBUTE_UN
       ? rtx_renumbered_equal_p (p1, p2) : rtx_equal_p (p1, p2))
     return true;

-  /* Do not do EQUIV substitution after reload.  First, we're undoing
the
-     work of reload_cse.  Second, we may be undoing the work of the
post-
-     reload splitting pass.  */
-  /* ??? Possibly add a new phase switch variable that can be used by
-     targets to disallow the troublesome insns after splitting.  */
-  if (!reload_completed)
-    {
-      /* The following code helps take care of G++ cleanups.  */
-      rtx equiv1 = find_reg_equal_equiv_note (i1);
-      rtx equiv2 = find_reg_equal_equiv_note (i2);
-
-      if (equiv1 && equiv2
-	  /* If the equivalences are not to a constant, they may
-	     reference pseudos that no longer exist, so we can't
-	     use them.  */
-	  && (! reload_completed
-	      || (CONSTANT_P (XEXP (equiv1, 0))
-		  && rtx_equal_p (XEXP (equiv1, 0), XEXP (equiv2, 0)))))
-	{
-	  rtx s1 = single_set (i1);
-	  rtx s2 = single_set (i2);
-	  if (s1 != 0 && s2 != 0
-	      && rtx_renumbered_equal_p (SET_DEST (s1), SET_DEST (s2)))
-	    {
-	      validate_change (i1, &SET_SRC (s1), XEXP (equiv1, 0), 1);
-	      validate_change (i2, &SET_SRC (s2), XEXP (equiv2, 0), 1);
-	      if (! rtx_renumbered_equal_p (p1, p2))
-		cancel_changes (0);
-	      else if (apply_change_group ())
-		return true;
-	    }
-	}
-    }
-
   return false;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]