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]

[vta,vta4.3,trunk?] avoid accidental moving of death notes in combine


move_deaths(), in combine, will happily take outdated last_death from
different BBs and try to move death notes, if the LUID of a REG's
last_death, within its own BB happens, to be between the LUIDs of two
combined insns, even though it doesn't make sense to compare LUIDs of
insns in different BBs.

I noticed this with -fcompare-debug, because a REG_DEAD note moved
about, because debug insns caused the LUIDs to accidentally pass the
tests.

This patch avoids the accident.  I don't have any testcase that
doesn't involve debug insns, and even that doesn't cause executable
code changes.  I'm going ahead and installing it in vta and vta4.3.
Should I install it in the trunk as well?

for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* combine.c (move_deaths): Compare LUIDs within the same BB only.

Index: gcc/combine.c
===================================================================
--- gcc/combine.c.orig	2008-09-05 03:09:21.000000000 -0300
+++ gcc/combine.c	2008-09-05 03:09:55.000000000 -0300
@@ -12311,7 +12311,7 @@ move_deaths (rtx x, rtx maybe_kill_insn,
 	  && ! reg_referenced_p (x, maybe_kill_insn))
 	return;
 
-      if (where_dead
+      if (where_dead && BLOCK_FOR_INSN (where_dead) == BLOCK_FOR_INSN (to_insn)
 	  && DF_INSN_LUID (where_dead) >= from_luid
 	  && DF_INSN_LUID (where_dead) < DF_INSN_LUID (to_insn))
 	{
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member       ÂSÃ Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}

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