combine.c (try_combine): Don't elim_i1 when it is used in i2src.
authorRichard Henderson <rth@cygnus.com>
Mon, 3 Nov 1997 06:24:36 +0000 (22:24 -0800)
committerJeff Law <law@gcc.gnu.org>
Mon, 3 Nov 1997 06:24:36 +0000 (23:24 -0700)
        * combine.c (try_combine): Don't elim_i1 when it is used in i2src.

        * combine.c (try_combine): When setting elim_i2, check whether newi2pat
        sets i2dest.  When calling distribute_notes for i3dest_killed, pass
        elim_i2 and elim_i1.

Co-Authored-By: Jim Wilson <wilson@cygnus.com>
From-SVN: r16296

gcc/ChangeLog
gcc/combine.c

index 7814f0688533b88e66c1d6c692eba19b80c78a0e..95110d5fdddc170313965caba8679646a80ecca3 100644 (file)
@@ -1,3 +1,12 @@
+Sun Nov  2 23:21:36 1997  Richard Henderson  <rth@cygnus.com>
+                          Jim Wilson  <wilson@cygnus.com>
+
+        * combine.c (try_combine): Don't elim_i1 when it is used in i2src.
+
+        * combine.c (try_combine): When setting elim_i2, check whether newi2pat
+        sets i2dest.  When calling distribute_notes for i3dest_killed, pass
+        elim_i2 and elim_i1.
+
 Sun Nov  2 19:44:00 1997  Robert Lipe (robertl@dgii.com)
 
        * i386/sco5.h: enable -gstabs once again.
index 20bcaf9b37e48dfa18d9e4466d229336bd2aba66..80fac52e28e9fe3f7d4f22315f242c896dbddc82 100644 (file)
@@ -1240,6 +1240,7 @@ try_combine (i3, i2, i1)
   rtx i2pat;
   /* Indicates if I2DEST or I1DEST is in I2SRC or I1_SRC.  */
   int i2dest_in_i2src = 0, i1dest_in_i1src = 0, i2dest_in_i1src = 0;
+  int i1dest_in_i2src = 0;
   int i1_feeds_i3 = 0;
   /* Notes that must be added to REG_NOTES in I3 and I2.  */
   rtx new_i3_notes, new_i2_notes;
@@ -1423,6 +1424,7 @@ try_combine (i3, i2, i1)
   i2dest_in_i2src = reg_overlap_mentioned_p (i2dest, i2src);
   i1dest_in_i1src = i1 && reg_overlap_mentioned_p (i1dest, i1src);
   i2dest_in_i1src = i1 && reg_overlap_mentioned_p (i2dest, i1src);
+  i1dest_in_i2src = i1 && reg_overlap_mentioned_p (i1dest, i2src);
 
   /* See if I1 directly feeds into I3.  It does if I1DEST is not used
      in I2SRC.  */
@@ -2146,10 +2148,12 @@ try_combine (i3, i2, i1)
     rtx i3links, i2links, i1links = 0;
     rtx midnotes = 0;
     register int regno;
-    /* Compute which registers we expect to eliminate.  */
-    rtx elim_i2 = (newi2pat || i2dest_in_i2src || i2dest_in_i1src
+    /* Compute which registers we expect to eliminate.  newi2pat may be setting
+       either i3dest or i2dest, so we must check it.  */
+    rtx elim_i2 = ((newi2pat && reg_set_p (i2dest, newi2pat))
+                  || i2dest_in_i2src || i2dest_in_i1src
                   ? 0 : i2dest);
-    rtx elim_i1 = i1 == 0 || i1dest_in_i1src ? 0 : i1dest;
+    rtx elim_i1 = i1 == 0 || i1dest_in_i1src || i1dest_in_i2src ? 0 : i1dest;
 
     /* Get the old REG_NOTES and LOG_LINKS from all our insns and
        clear them.  */
@@ -2317,7 +2321,7 @@ try_combine (i3, i2, i1)
          distribute_notes (gen_rtx (EXPR_LIST, REG_DEAD, i3dest_killed,
                                     NULL_RTX),
                            NULL_RTX, i3, newi2pat ? i2 : NULL_RTX,
-                           NULL_RTX, NULL_RTX);
+                           elim_i2, elim_i1);
       }
 
     if (i2dest_in_i2src)