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]

[PR debug/41353] adjust debug insns properly in remove


Brown paper b{a,i}g time.

The call to validate_replace_rtx_group when src was present in a debug
stmt was doubly-broken: dst and src were swapped, and the insn to fix
was wrong.  Ugh.

Furthermore, replacing src with dst and then checking that dst is not
present just ensures the replacement is useless: the debug expression
would always match.  Oops.  Reordering the tests fixed it.

Here's what I'm testing to fix the problem in comment #9 of PR
debug/41353.  Ok to install if it regstraps?

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

	PR debug/41353
	* regmove.c (regmove_backward_pass): Replace src with dst in the
	debug insn, and check for dst before rather than after.

Index: gcc/regmove.c
===================================================================
--- gcc/regmove.c.orig	2009-10-06 03:51:43.000000000 -0300
+++ gcc/regmove.c	2009-10-06 04:02:08.000000000 -0300
@@ -1122,18 +1122,18 @@ regmove_backward_pass (void)
 		     eliminate SRC. We can't make this change 
 		     if DST is mentioned at all in P,
 		     since we are going to change its value.  */
-		  if (reg_overlap_mentioned_p (src, PATTERN (p)))
+		  if (reg_mentioned_p (dst, PATTERN (p)))
 		    {
 		      if (DEBUG_INSN_P (p))
-			validate_replace_rtx_group (dst, src, insn);
+			validate_change (p, &INSN_VAR_LOCATION_LOC (p),
+					 gen_rtx_UNKNOWN_VAR_LOC (), 1);
 		      else
 			break;
 		    }
-		  if (reg_mentioned_p (dst, PATTERN (p)))
+		  if (reg_overlap_mentioned_p (src, PATTERN (p)))
 		    {
 		      if (DEBUG_INSN_P (p))
-			validate_change (p, &INSN_VAR_LOCATION_LOC (p),
-					 gen_rtx_UNKNOWN_VAR_LOC (), 1);
+			validate_replace_rtx_group (src, dst, p);
 		      else
 			break;
 		    }
-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

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