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]

[PATCH] DCE: Remove LIBCALL/RETVAL notes if they are moved to the same insn


Hello,

mainline GCC currently doesn't bootstrap on s390 and s390x.

The problem is that the recent dce changes might produce insns like:

144r.ce1:

(insn 14 11 15 2 /build2/gcc-4.3/libgomp/iter.c:45 (set (reg:DI 73)
        (reg:DI 71)) 50 {*movdi_64} (insn_list:REG_LIBCALL 14 (expr_list:REG_DEAD (reg:DI 71)
            (insn_list:REG_RETVAL 14 (expr_list:REG_EQUAL (unspec:DI [
                            (symbol_ref:DI ("gomp_tls_data") [flags 0x4a] <var_decl 0x200003741f8 gomp_tls_data>)
                        ] 502)
                    (nil))))))

Which can't be handled by cse.  Note that both notes - LIBCALL and
RETVAL - point to this insn.

The rest of the libcall is dead and therefore correctly thrown away.

I'm currently testing the attached patch.  It fixes the testcase which
made the s390x GCC fail bootstrapping.

OK for mainline?

Bye,

-Andreas-


2007-10-26  Andreas Krebbel  <krebbel1@de.ibm.com>

	* dce.c (delete_unmarked_insns): Just delete the RETVAL and
	LIBCALL notes if they are about to be moved to the same insn.


Index: gcc/dce.c
===================================================================
--- gcc/dce.c	(revision 129646)
+++ gcc/dce.c	(working copy)
@@ -346,10 +346,17 @@
 	      rtx new_libcall_insn = next_real_insn (insn);
 	      rtx retval_note = find_reg_note (XEXP (note, 0),
 					       REG_RETVAL, NULL_RTX);
-	      REG_NOTES (new_libcall_insn)
-		= gen_rtx_INSN_LIST (REG_LIBCALL, XEXP (note, 0),
-				     REG_NOTES (new_libcall_insn));
-	      XEXP (retval_note, 0) = new_libcall_insn;
+	      /* If the RETVAL and LIBCALL notes would land on the same
+		 insn just remove them.  */
+	      if (XEXP (note, 0) == new_libcall_insn)
+		remove_note (new_libcall_insn, retval_note);
+	      else
+		{
+		  REG_NOTES (new_libcall_insn)
+		    = gen_rtx_INSN_LIST (REG_LIBCALL, XEXP (note, 0),
+					 REG_NOTES (new_libcall_insn));
+		  XEXP (retval_note, 0) = new_libcall_insn;
+		}
 	    }
 
 	  /* If the insn contains a REG_RETVAL note and is dead, but the


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