(count_reg_usage, case SET): If SRC has side-effects, count a usage of
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 26 Feb 1994 21:11:04 +0000 (16:11 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 26 Feb 1994 21:11:04 +0000 (16:11 -0500)
DEST in it.

From-SVN: r6631

gcc/cse.c

index 81263b7..b029478 100644 (file)
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -8338,7 +8338,16 @@ count_reg_usage (x, counts, dest, incr)
       /* Unless we are setting a REG, count everything in SET_DEST.  */
       if (GET_CODE (SET_DEST (x)) != REG)
        count_reg_usage (SET_DEST (x), counts, NULL_RTX, incr);
-      count_reg_usage (SET_SRC (x), counts, SET_DEST (x), incr);
+
+      /* If SRC has side-effects, then we can't delete this insn, so the
+        usage of SET_DEST inside SRC counts.
+
+        ??? Strictly-speaking, we might be preserving this insn
+        because some other SET has side-effects, but that's hard
+        to do and can't happen now.  */
+      count_reg_usage (SET_SRC (x), counts,
+                      side_effects_p (SET_SRC (x)) ? NULL_RTX : SET_DEST (x),
+                      incr);
       return;
 
     case INSN: