This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR42509, wrong-code from the RTL alias oracle
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: rearnsha at gcc dot gnu dot org
- Date: Fri, 2 Apr 2010 19:06:58 +0200 (CEST)
- Subject: [PATCH] Fix PR42509, wrong-code from the RTL alias oracle
This fixes PR42509, a bug in nonoverlapping_memrefs_p whose
conservative fallback for NULL MEM_OFFSET assumes DECLs are not offsetted
with negative offsets - which is not true for the spill slot decl.
This is the issue bootstrap on arm-linux-gnueabi runs into
(with some other special configure options), but the issue is
generic and in this special case triggered by cross-jumping
NULLing MEM_OFFSET.
The patch provides local surgery to nonoverlapping_memrefs_p
to avoid triggering the issue. For 4.6 we want certain MEMs
(such as the not aliased spill slot references) to be special
cased all the way through the oracle.
Bootstrapped and tested on x86_64-unknown-linux-gnu, Richard
is bootstrapping on arm-linux-gnueabi. I'll commit this
to trunk once he confirms that the issue is fixed by this
patch.
Thanks,
Richard.
2010-04-02 Richard Guenther <rguenther@suse.de>
PR middle-end/42509
* alias.c (nonoverlapping_memrefs_p): For spill-slot accesses
require a non-NULL MEM_OFFSET.
Index: gcc/alias.c
===================================================================
*** gcc/alias.c (revision 157942)
--- gcc/alias.c (working copy)
*************** nonoverlapping_memrefs_p (const_rtx x, c
*** 2147,2152 ****
--- 2147,2159 ----
if (exprx == 0 || expry == 0)
return 0;
+ /* For spill-slot accesses make sure we have valid offsets. */
+ if ((exprx == get_spill_slot_decl (false)
+ && ! MEM_OFFSET (x))
+ || (expry == get_spill_slot_decl (false)
+ && ! MEM_OFFSET (y)))
+ return 0;
+
/* If both are field references, we may be able to determine something. */
if (TREE_CODE (exprx) == COMPONENT_REF
&& TREE_CODE (expry) == COMPONENT_REF