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: [RFA] A patch for PR 25115



I attached a different patch to PR25115. Since the change to hash_scan_set uses a note to populate the hash table, my patch uses the note to figure out the parameter to gen_move_insn. I'll post the patch formally after bootstrap/regtest finishes on powerpc-darwin-8.2.0; the patch fixes the test case on sh.

Indeed, Kaz confirmed that it fixes the ICE. It produces better code on a s390 testcase attached to PR25115, and worse code on the original sh testcase. I'll look at the sh pessimization in the near future; in the meanwhile, ok to commit?


Paolo
2005-11-28  Paolo Bonzini  <bonzini@gnu.org>

	PR 25115
	* gcse.c (pre_insert_copy_insn): Try to make the new insn
	out of a REG_EQUAL or REG_EQUIV note.  Check with expr_equiv_p
	even if PAT is not a PARALLEL.

Index: gcse.c
===================================================================
--- gcse.c	(revision 107456)
+++ gcse.c	(working copy)
@@ -4218,7 +4218,7 @@ pre_insert_copy_insn (struct expr *expr,
   int regno = REGNO (reg);
   int indx = expr->bitmap_index;
   rtx pat = PATTERN (insn);
-  rtx set, new_insn;
+  rtx set = NULL_RTX, new_insn;
   rtx old_reg;
   int i;
 
@@ -4226,13 +4226,13 @@ pre_insert_copy_insn (struct expr *expr,
   switch (GET_CODE (pat))
     {
     case SET:
-      set = pat;
+      if (expr_equiv_p (SET_SRC (pat), expr->expr))
+	set = pat;
       break;
 
     case PARALLEL:
       /* Search through the parallel looking for the set whose
 	 source was the expression that we're interested in.  */
-      set = NULL_RTX;
       for (i = 0; i < XVECLEN (pat, 0); i++)
 	{
 	  rtx x = XVECEXP (pat, 0, i);
@@ -4249,7 +4249,18 @@ pre_insert_copy_insn (struct expr *expr,
       gcc_unreachable ();
     }
 
-  if (REG_P (SET_DEST (set)))
+  if (!set)
+    {
+      rtx note = find_reg_equal_equiv_note (insn);
+      gcc_assert (note);
+      new_insn = gen_move_insn (reg, XEXP (note, 0));
+      new_insn = emit_insn_after (new_insn, insn);
+
+      /* Keep register set table up to date.  */
+      record_one_set (regno, new_insn);
+    }
+
+  else if (REG_P (SET_DEST (set)))
     {
       old_reg = SET_DEST (set);
       /* Check if we can modify the set destination in the original insn.  */

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