When trying to figure out whether it can re-materialize a memory
load before the use in
<read> ... = equiv_mem;
<write> dest = ...;
<use>
IRA manages to get alias queries wrong by using true_dependence
(which is for read-after-write) instead of anti_dependence as
it wants to test whether the write invalidates equiv_mem.
Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for trunk?
Ok for the 4.8 branch at this point?
Thanks,
Richard.
2013-05-23 Richard Biener <[email protected]>
PR rtl-optimization/57341
* ira.c (validate_equiv_mem_from_store): Use anti_dependence
instead of true_dependence.
* gcc.dg/torture/pr57341.c: New testcase.
Index: gcc/ira.c
===================================================================
--- gcc/ira.c (revision 199199)
+++ gcc/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;
}
Index: gcc/testsuite/gcc.dg/torture/pr57341.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr57341.c (revision 0)
--- gcc/testsuite/gcc.dg/torture/pr57341.c (revision 0)
***************
*** 0 ****
--- 1,22 ----
+ /* { dg-do run } */
+ /* { dg-additional-options "-msse" { target sse2_runtime } } */
+
+ int a, d;
+ int *b = &a, **c;
+ int
+ main ()
+ {
+ int e;
+ {
+ int f[4];
+ for (d = 0; d < 4; d++)
+ f[d] = 1;
+ e = f[1];
+ }
+ int *g[28] = { };
+ *b = e;
+ c = &g[0];
+ if (a != 1)
+ __builtin_abort ();
+ return 0;
+ }