OSDN Git Service

PR debug/41353
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Oct 2009 19:20:22 +0000 (19:20 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 8 Oct 2009 19:20:22 +0000 (19:20 +0000)
* regmove.c (regmove_backward_pass): Replace src with dst in the
debug insn, and check for dst before rather than after.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152573 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/regmove.c

index e91ab6d..a7e2290 100644 (file)
@@ -1,3 +1,9 @@
+2009-10-08  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.
+
 2009-10-08  Janis Johnson <janis187@us.ibm.com>
 
        * config/rs6000/rs6000.c (rs6000_delegitimize_address): Remove.
index ab1a469..a411183 100644 (file)
@@ -1117,23 +1117,28 @@ regmove_backward_pass (void)
                      break;
                    }
 
-                 /* We can't make this change if SRC is read or
+                 /* We can't make this change if DST is mentioned at
+                    all in P, since we are going to change its value.
+                    We can't make this change if SRC is read or
                     partially written in P, since we are going to
-                    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)))
+                    eliminate SRC.  However, if it's a debug insn, we
+                    can't refrain from making the change, for this
+                    would cause codegen differences, so instead we
+                    invalidate debug expressions that reference DST,
+                    and adjust references to SRC in them so that they
+                    become references to DST.  */
+                 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;
                    }