===================================================================
@@ -2306,11 +2306,19 @@ nonoverlapping_memrefs_p (const_rtx x, c
return 1;
/* If we have MEMs refering to different address spaces (which can
- potentially overlap), we cannot easily tell from the addresses
- whether the references overlap. */
+ potentially overlap), they are not aliased if neither is subset
+ of the other one. */
if (MEM_P (rtlx) && MEM_P (rtly)
&& MEM_ADDR_SPACE (rtlx) != MEM_ADDR_SPACE (rtly))
- return 0;
+ {
+ if (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (rtlx),
+ MEM_ADDR_SPACE (rtly))
+ && !targetm.addr_space.subset_p (MEM_ADDR_SPACE (rtly),
+ MEM_ADDR_SPACE (rtlx)))
+ return 1;
+ else
+ return 0;
+ }
/* Get the base and offsets of both decls. If either is a register, we
know both are and are the same, so use that as the base. The only
@@ -2417,10 +2425,18 @@ true_dependence_1 (const_rtx mem, enum m
return 0;
/* If we have MEMs refering to different address spaces (which can
- potentially overlap), we cannot easily tell from the addresses
- whether the references overlap. */
+ potentially overlap), they are not aliased if neither is subset
+ of the other one. */
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
- return 1;
+ {
+ if (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (mem),
+ MEM_ADDR_SPACE (x))
+ && !targetm.addr_space.subset_p (MEM_ADDR_SPACE (x),
+ MEM_ADDR_SPACE (mem)))
+ return 0;
+ else
+ return 1;
+ }
if (! mem_addr)
{
@@ -2542,10 +2558,18 @@ write_dependence_p (const_rtx mem, const
return 0;
/* If we have MEMs refering to different address spaces (which can
- potentially overlap), we cannot easily tell from the addresses
- whether the references overlap. */
+ potentially overlap), they are not aliased if neither is subset
+ of the other one. */
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
- return 1;
+ {
+ if (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (mem),
+ MEM_ADDR_SPACE (x))
+ && !targetm.addr_space.subset_p (MEM_ADDR_SPACE (x),
+ MEM_ADDR_SPACE (mem)))
+ return 0;
+ else
+ return 1;
+ }
x_addr = XEXP (x, 0);
mem_addr = XEXP (mem, 0);
@@ -2637,10 +2661,18 @@ may_alias_p (const_rtx mem, const_rtx x)
return 0;
/* If we have MEMs refering to different address spaces (which can
- potentially overlap), we cannot easily tell from the addresses
- whether the references overlap. */
+ potentially overlap), they are not aliased if neither is subset
+ of the other one. */
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
- return 1;
+ {
+ if (!targetm.addr_space.subset_p (MEM_ADDR_SPACE (mem),
+ MEM_ADDR_SPACE (x))
+ && !targetm.addr_space.subset_p (MEM_ADDR_SPACE (x),
+ MEM_ADDR_SPACE (mem)))
+ return 0;
+ else
+ return 1;
+ }
x_addr = XEXP (x, 0);
mem_addr = XEXP (mem, 0);