diff mbox

[v2,middle-end] : Fix PR68999, gfortran.fortran-torture/execute/save_1.f90 execution failure on alpha

Message ID CAFULd4ZXJ25HsdW-zCAX8SqTjHTrmkYX4+g_eopNa6SwzhuY+g@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak Jan. 8, 2016, 4:23 p.m. UTC
Hello!

Attached patch returns "unknown" from memrefs_conflict_p when
realigned decls are processed. This is the same approach as is done at
the end of memrefs_conflict_p.

We still need early return for AND addresses in base_alias_check.

2016-01-08  Uros Bizjak  <ubizjak@gmail.com>

    PR middle-end/68999
    * alias.c (memrefs_conflict_p): Return -1 for different decls
    that went through alignment adjustments.
    (base_alias_check): Move check for addresses with alignment ANDs
    before the call for compare_base_decls.

Patch was bootstrapped and regression tested on x86_64-linux-gnu
{,-m32} and alpha-linux-gnu native [2].

OK for mainline?

Uros.

Comments

Richard Biener Jan. 11, 2016, 8:50 a.m. UTC | #1
On Fri, Jan 8, 2016 at 5:23 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
> Hello!
>
> Attached patch returns "unknown" from memrefs_conflict_p when
> realigned decls are processed. This is the same approach as is done at
> the end of memrefs_conflict_p.
>
> We still need early return for AND addresses in base_alias_check.
>
> 2016-01-08  Uros Bizjak  <ubizjak@gmail.com>
>
>     PR middle-end/68999
>     * alias.c (memrefs_conflict_p): Return -1 for different decls
>     that went through alignment adjustments.
>     (base_alias_check): Move check for addresses with alignment ANDs
>     before the call for compare_base_decls.
>
> Patch was bootstrapped and regression tested on x86_64-linux-gnu
> {,-m32} and alpha-linux-gnu native [2].
>
> OK for mainline?

Ok.

Thanks,
Richard.

> Uros.
diff mbox

Patch

Index: alias.c
===================================================================
--- alias.c	(revision 232172)
+++ alias.c	(working copy)
@@ -2093,17 +2093,6 @@  base_alias_check (rtx x, rtx x_base, rtx y, rtx y_
   if (rtx_equal_p (x_base, y_base))
     return 1;
 
-  if (GET_CODE (x_base) == SYMBOL_REF && GET_CODE (y_base) == SYMBOL_REF)
-    {
-      tree x_decl = SYMBOL_REF_DECL (x_base);
-      tree y_decl = SYMBOL_REF_DECL (y_base);
-
-      /* We can assume that no stores are made to labels.  */
-      if (!x_decl || !y_decl)
-	return 0;
-      return compare_base_decls (x_decl, y_decl) != 0;
-    }
-
   /* The base addresses are different expressions.  If they are not accessed
      via AND, there is no conflict.  We can bring knowledge of object
      alignment into play here.  For example, on alpha, "char a, b;" can
@@ -2122,6 +2111,17 @@  base_alias_check (rtx x, rtx x_base, rtx y, rtx y_
 	  || (int) GET_MODE_UNIT_SIZE (x_mode) < -INTVAL (XEXP (y, 1))))
     return 1;
 
+  if (GET_CODE (x_base) == SYMBOL_REF && GET_CODE (y_base) == SYMBOL_REF)
+    {
+      tree x_decl = SYMBOL_REF_DECL (x_base);
+      tree y_decl = SYMBOL_REF_DECL (y_base);
+
+      /* We can assume that no stores are made to labels.  */
+      if (!x_decl || !y_decl)
+	return 0;
+      return compare_base_decls (x_decl, y_decl) != 0;
+    }
+
   /* Differing symbols not accessed via AND never alias.  */
   if (GET_CODE (x_base) != ADDRESS && GET_CODE (y_base) != ADDRESS)
     return 0;
@@ -2344,6 +2344,12 @@  memrefs_conflict_p (int xsize, rtx x, int ysize, r
       /* If both decls are the same, decide by offsets.  */
       if (cmp == 1)
         return offset_overlap_p (c, xsize, ysize);
+      /* Assume a potential overlap for symbolic addresses that went
+	 through alignment adjustments (i.e., that have negative
+	 sizes), because we can't know how far they are from each
+	 other.  */
+      if (xsize < 0 || ysize < 0)
+	return -1;
       /* If decls are different or we know by offsets that there is no overlap,
 	 we win.  */
       if (!cmp || !offset_overlap_p (c, xsize, ysize))