[Bug target/57341] [4.8/4.9 Regression] wrong code on x86_64-linux at -O3 in 32-bit mode

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 22 14:23:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57341

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #2)
> Seems validate_equiv_mem_from_store during update_equiv_regs calls
> true_dependence to find out if it is safe to use it as equiv, and
> true_dependence is called with
> x being
> (mem/c:SI (plus:SI (reg/f:SI 20 frame)
>         (const_int -108 [0xffffffffffffff94])) [3 f+4 S4 A32])
> and mem being
> (mem/c:BLK (reg:SI 64) [2 g+0 S112 A128])
> and returns 0 because the alias sets weren't properly adjusted.

It seems the code really wants to use anti_dependence, not true_dependence.
We have

   <read> ... = equiv_mem;
   <write> dest = ...;
        <use>

and the code wants to check whether moving the read before the use,
bypassing <write> is possible.  Even a write that does not conflict
TBAA wise is a barrier for this transform.

Index: ira.c
===================================================================
--- ira.c       (revision 199199)
+++ ira.c       (working copy)
@@ -2520,7 +2520,7 @@ validate_equiv_mem_from_store (rtx dest,
   if ((REG_P (dest)
        && reg_overlap_mentioned_p (dest, equiv_mem))
       || (MEM_P (dest)
-         && true_dependence (dest, VOIDmode, equiv_mem)))
+         && anti_dependence (equiv_mem, dest)))
     equiv_mem_modified = 1;
 }



More information about the Gcc-bugs mailing list