Patch fixing 3.3 bug PR 9745 and PR 10021

Dale Johannesen dalej@apple.com
Wed Jul 2 17:40:00 GMT 2003


On Wednesday, July 2, 2003, at 10:15  AM, Mark Mitchell wrote:
> Independent of what targets the bug affects, this reinforces my key
> point: that someone is going to have to work hard to fix this aliasing
> issue, and until that point we have to choose between wrong code and
> slow code.
>
> Personally, I'd choose slow code.  Not only is that better for our
> users, some of whom use GCC to build very critical systems, but it 
> would
> also encourage someone to go solve the optimization problem.

Perhaps at this point there is some interest in my compromise patch 
below,
although it's not the sort of thing I'd normally submit.
This is not a clean fix for the entire problem.  It does fix some cases 
of the
problem, without introducing performance regressions.   The cases it 
fixes
includes two we found running SPEC with IMI, and should fix the ones in 
10021
and 9745, although I haven't tried them.

Index: alias.c
===================================================================
RCS file: /cvs/repository/CoreTools/gcc3/gcc/alias.c,v
retrieving revision 1.18.2.1.2.3
retrieving revision 1.18.2.1.2.4
diff -u -d -b -w -c -3 -p -r1.18.2.1.2.3 -r1.18.2.1.2.4
cvs server: conflicting specifications of output style
*** alias.c     2003/06/04 15:49:22     1.18.2.1.2.3
--- alias.c     2003/06/18 21:13:49     1.18.2.1.2.4
*************** true_dependence (mem, mem_mode, x, varie
*** 2158,2163 ****
--- 2158,2173 ----
                    && CONSTANT_POOL_ADDRESS_P (base))))
       return 0;

+   /* If MEM_EXPR info is available and indicates that
+      both refs refer to the same symbol, they interfere. */
+   if (MEM_EXPR (mem) && MEM_EXPR (mem) == MEM_EXPR (x))
+     {
+       if (MEM_OFFSET (mem) == 0 || MEM_OFFSET (x) == 0)
+        return 1;
+       if (rtx_equal_p (MEM_OFFSET (mem), MEM_OFFSET (x)))
+        return 1;
+     }
+
     if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
       return 0;

*************** canon_true_dependence (mem, mem_mode, me
*** 2229,2234 ****
--- 2239,2254 ----
       return 0;

     x_addr = get_addr (XEXP (x, 0));
+
+   /* If MEM_EXPR info is available and indicates that
+      both refs refer to the same symbol, they interfere. */
+   if (MEM_EXPR (mem) && MEM_EXPR (mem) == MEM_EXPR (x))
+     {
+       if (MEM_OFFSET (mem) == 0 || MEM_OFFSET (x) == 0)
+        return 1;
+       if (rtx_equal_p (MEM_OFFSET (mem), MEM_OFFSET (x)))
+        return 1;
+     }

     if (! base_alias_check (x_addr, mem_addr, GET_MODE (x), mem_mode))
       return 0;



More information about the Gcc mailing list