+2014-03-17 Mikael Pettersson <mikpelinux@gmail.com>
+ Committed by Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ Backport from mainline:
+
+ 2013-06-20 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR rtl-optimization/57425
+ PR rtl-optimization/57569
+ * alias.c (write_dependence_p): Remove parameters mem_mode and
+ canon_mem_addr. Add parameters x_mode, x_addr and x_canonicalized.
+ Changed all callers.
+ (canon_anti_dependence): Get comments and semantics in sync.
+ Add parameter mem_canonicalized. Changed all callers.
+ * rtl.h (canon_anti_dependence): Update prototype.
+
+ 2013-06-16 Joern Rennecke <joern.rennecke@embecosm.com>
+
+ PR rtl-optimization/57425
+ PR rtl-optimization/57569
+ * alias.c (write_dependence_p): Add new parameters mem_mode,
+ canon_mem_addr and mem_canonicalized. Change type of writep to bool.
+ Changed all callers.
+ (canon_anti_dependence): New function.
+ * cse.c (check_dependence): Use canon_anti_dependence.
+ * cselib.c (cselib_invalidate_mem): Likewise.
+ * rtl.h (canon_anti_dependence): Declare.
+
2014-03-17 Richard Biener <rguenther@suse.de>
Backport from mainline
static alias_set_entry get_alias_set_entry (alias_set_type);
static bool nonoverlapping_component_refs_p (const_rtx, const_rtx);
static tree decl_for_component_ref (tree);
-static int write_dependence_p (const_rtx, const_rtx, int);
+static int write_dependence_p (const_rtx,
+ const_rtx, enum machine_mode, rtx,
+ bool, bool, bool);
static void memory_modified_1 (rtx, const_rtx, void *);
}
/* Returns nonzero if a write to X might alias a previous read from
- (or, if WRITEP is nonzero, a write to) MEM. */
+ (or, if WRITEP is true, a write to) MEM.
+ If X_CANONCALIZED is true, then X_ADDR is the canonicalized address of X,
+ and X_MODE the mode for that access.
+ If MEM_CANONICALIZED is true, MEM is canonicalized. */
static int
-write_dependence_p (const_rtx mem, const_rtx x, int writep)
+write_dependence_p (const_rtx mem,
+ const_rtx x, enum machine_mode x_mode, rtx x_addr,
+ bool mem_canonicalized, bool x_canonicalized, bool writep)
{
- rtx x_addr, mem_addr;
+ rtx mem_addr;
rtx base;
int ret;
+ gcc_checking_assert (x_canonicalized
+ ? (x_addr != NULL_RTX && x_mode != VOIDmode)
+ : (x_addr == NULL_RTX && x_mode == VOIDmode));
+
if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
return 1;
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
return 1;
- x_addr = XEXP (x, 0);
mem_addr = XEXP (mem, 0);
- if (!((GET_CODE (x_addr) == VALUE
- && GET_CODE (mem_addr) != VALUE
- && reg_mentioned_p (x_addr, mem_addr))
- || (GET_CODE (x_addr) != VALUE
- && GET_CODE (mem_addr) == VALUE
- && reg_mentioned_p (mem_addr, x_addr))))
+ if (!x_addr)
{
- x_addr = get_addr (x_addr);
- mem_addr = get_addr (mem_addr);
+ x_addr = XEXP (x, 0);
+ if (!((GET_CODE (x_addr) == VALUE
+ && GET_CODE (mem_addr) != VALUE
+ && reg_mentioned_p (x_addr, mem_addr))
+ || (GET_CODE (x_addr) != VALUE
+ && GET_CODE (mem_addr) == VALUE
+ && reg_mentioned_p (mem_addr, x_addr))))
+ {
+ x_addr = get_addr (x_addr);
+ if (!mem_canonicalized)
+ mem_addr = get_addr (mem_addr);
+ }
}
if (! writep)
GET_MODE (mem)))
return 0;
- x_addr = canon_rtx (x_addr);
- mem_addr = canon_rtx (mem_addr);
+ if (!x_canonicalized)
+ {
+ x_addr = canon_rtx (x_addr);
+ x_mode = GET_MODE (x);
+ }
+ if (!mem_canonicalized)
+ mem_addr = canon_rtx (mem_addr);
if ((ret = memrefs_conflict_p (SIZE_FOR_MODE (mem), mem_addr,
- SIZE_FOR_MODE (x), x_addr, 0)) != -1)
+ GET_MODE_SIZE (x_mode), x_addr, 0)) != -1)
return ret;
if (nonoverlapping_memrefs_p (x, mem, false))
int
anti_dependence (const_rtx mem, const_rtx x)
{
- return write_dependence_p (mem, x, /*writep=*/0);
+ return write_dependence_p (mem, x, VOIDmode, NULL_RTX,
+ /*mem_canonicalized=*/false,
+ /*x_canonicalized*/false, /*writep=*/false);
+}
+
+/* Likewise, but we already have a canonicalized MEM, and X_ADDR for X.
+ Also, consider X in X_MODE (which might be from an enclosing
+ STRICT_LOW_PART / ZERO_EXTRACT).
+ If MEM_CANONICALIZED is true, MEM is canonicalized. */
+
+int
+canon_anti_dependence (const_rtx mem, bool mem_canonicalized,
+ const_rtx x, enum machine_mode x_mode, rtx x_addr)
+{
+ return write_dependence_p (mem, x, x_mode, x_addr,
+ mem_canonicalized, /*x_canonicalized=*/true,
+ /*writep=*/false);
}
/* Output dependence: X is written after store in MEM takes place. */
int
output_dependence (const_rtx mem, const_rtx x)
{
- return write_dependence_p (mem, x, /*writep=*/1);
+ return write_dependence_p (mem, x, VOIDmode, NULL_RTX,
+ /*mem_canonicalized=*/false,
+ /*x_canonicalized*/false, /*writep=*/true);
}
\f