sched.c (canon_rtx): Recursively look for equivalences; look for expressions equivale...
authorJeff Law <law@gcc.gnu.org>
Mon, 18 Dec 1995 01:31:12 +0000 (18:31 -0700)
committerJeff Law <law@gcc.gnu.org>
Mon, 18 Dec 1995 01:31:12 +0000 (18:31 -0700)
        * sched.c (canon_rtx): Recursively look for equivalences;
        look for expressions equivalent to MEMs.
        (true_dependence): Canonicalize inputs before operating
        on their values.
        (anti_dependence, output_dependence): Likewise.

        * jump.c (follow_jumps): Don't follow an unconditional jump
        that is not a simple_jump.

From-SVN: r10793

gcc/jump.c
gcc/sched.c

index 88a6c3a..2fd8be5 100644 (file)
@@ -3054,7 +3054,8 @@ follow_jumps (label)
        (depth < 10
        && (insn = next_active_insn (value)) != 0
        && GET_CODE (insn) == JUMP_INSN
-       && (JUMP_LABEL (insn) != 0 || GET_CODE (PATTERN (insn)) == RETURN)
+       && ((JUMP_LABEL (insn) != 0 && simplejump_p (insn))
+           || GET_CODE (PATTERN (insn)) == RETURN)
        && (next = NEXT_INSN (insn))
        && GET_CODE (next) == BARRIER);
        depth++)
index 81d77bf..2be6f9d 100644 (file)
@@ -371,9 +371,11 @@ static rtx
 canon_rtx (x)
      rtx x;
 {
+  /* Recursively look for equivalences.  */
   if (GET_CODE (x) == REG && REGNO (x) >= FIRST_PSEUDO_REGISTER
       && REGNO (x) <= reg_known_value_size)
-    return reg_known_value[REGNO (x)];
+    return reg_known_value[REGNO (x)] == x
+      ? x : canon_rtx (reg_known_value[REGNO (x)]);
   else if (GET_CODE (x) == PLUS)
     {
       rtx x0 = canon_rtx (XEXP (x, 0));
@@ -390,6 +392,16 @@ canon_rtx (x)
          return gen_rtx (PLUS, GET_MODE (x), x0, x1);
        }
     }
+  /* This gives us much better alias analysis when called from
+     the loop optimizer.   Note we want to leave the original
+     MEM alone, but need to return the canonicalized MEM with
+     all the flags with their original values.  */
+  else if (GET_CODE (x) == MEM)
+    {
+      rtx copy = copy_rtx (x);
+      XEXP (copy, 0) = canon_rtx (XEXP (copy, 0));
+      x = copy;
+    }
   return x;
 }
 
@@ -825,6 +837,8 @@ true_dependence (mem, x)
      both an unchanging read and an unchanging write.  This won't handle all
      cases optimally, but the possible performance loss should be
      negligible.  */
+  x = canon_rtx (x);
+  mem = canon_rtx (mem);
   if (RTX_UNCHANGING_P (x) && ! RTX_UNCHANGING_P (mem))
     return 0;
 
@@ -849,6 +863,8 @@ anti_dependence (mem, x)
   /* If MEM is an unchanging read, then it can't possibly conflict with
      the store to X, because there is at most one store to MEM, and it must
      have occurred somewhere before MEM.  */
+  x = canon_rtx (x);
+  mem = canon_rtx (mem);
   if (RTX_UNCHANGING_P (mem))
     return 0;
 
@@ -870,6 +886,8 @@ output_dependence (mem, x)
      rtx mem;
      rtx x;
 {
+  x = canon_rtx (x);
+  mem = canon_rtx (mem);
   return ((MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
          || (memrefs_conflict_p (SIZE_FOR_MODE (mem), XEXP (mem, 0),
                                  SIZE_FOR_MODE (x), XEXP (x, 0), 0)