OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / alias.c
index 4bda40d..f20716d 100644 (file)
@@ -1811,20 +1811,34 @@ get_addr (rtx x)
   v = CSELIB_VAL_PTR (x);
   if (v)
     {
-      v = canonical_cselib_val (v);
+      bool have_equivs = cselib_have_permanent_equivalences ();
+      if (have_equivs)
+       v = canonical_cselib_val (v);
       for (l = v->locs; l; l = l->next)
        if (CONSTANT_P (l->loc))
          return l->loc;
       for (l = v->locs; l; l = l->next)
-       if (!REG_P (l->loc) && !MEM_P (l->loc) && GET_CODE (l->loc) != VALUE
-           && !refs_newer_value_p (l->loc, x))
+       if (!REG_P (l->loc) && !MEM_P (l->loc)
+           /* Avoid infinite recursion when potentially dealing with
+              var-tracking artificial equivalences, by skipping the
+              equivalences themselves, and not choosing expressions
+              that refer to newer VALUEs.  */
+           && (!have_equivs
+               || (GET_CODE (l->loc) != VALUE
+                   && !refs_newer_value_p (l->loc, x))))
          return l->loc;
-      for (l = v->locs; l; l = l->next)
-       if (REG_P (l->loc) || (GET_CODE (l->loc) != VALUE
-                              && !refs_newer_value_p (l->loc, x)))
-         return l->loc;
-      /* Return the canonical value.  */
-      return v->val_rtx;
+      if (have_equivs)
+       {
+         for (l = v->locs; l; l = l->next)
+           if (REG_P (l->loc)
+               || (GET_CODE (l->loc) != VALUE
+                   && !refs_newer_value_p (l->loc, x)))
+             return l->loc;
+         /* Return the canonical value.  */
+         return v->val_rtx;
+       }
+      if (v->locs)
+       return v->locs->loc;
     }
   return x;
 }
@@ -2113,12 +2127,18 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, HOST_WIDE_INT c)
    storeqi_unaligned pattern.  */
 
 /* Read dependence: X is read after read in MEM takes place.  There can
-   only be a dependence here if both reads are volatile.  */
+   only be a dependence here if both reads are volatile, or if either is
+   an explicit barrier.  */
 
 int
 read_dependence (const_rtx mem, const_rtx x)
 {
-  return MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem);
+  if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
+    return true;
+  if (MEM_ALIAS_SET (x) == ALIAS_SET_MEMORY_BARRIER
+      || MEM_ALIAS_SET (mem) == ALIAS_SET_MEMORY_BARRIER)
+    return true;
+  return false;
 }
 
 /* Returns nonzero if something about the mode or address format MEM1