mirror of git://gcc.gnu.org/git/gcc.git
re PR rtl-optimization/57425 (RTL alias analysis unprepared to handle stack slot sharing)
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.
From-SVN: r200241
This commit is contained in:
parent
d16e9a99f9
commit
bd280792f0
|
|
@ -1,3 +1,14 @@
|
||||||
|
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-20 Richard Biener <rguenther@suse.de>
|
2013-06-20 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
* data-streamer-in.c (streamer_read_uhwi): Optimize single
|
* data-streamer-in.c (streamer_read_uhwi): Optimize single
|
||||||
|
|
|
||||||
86
gcc/alias.c
86
gcc/alias.c
|
|
@ -156,8 +156,9 @@ static int insert_subset_children (splay_tree_node, void*);
|
||||||
static alias_set_entry get_alias_set_entry (alias_set_type);
|
static alias_set_entry get_alias_set_entry (alias_set_type);
|
||||||
static bool nonoverlapping_component_refs_p (const_rtx, const_rtx);
|
static bool nonoverlapping_component_refs_p (const_rtx, const_rtx);
|
||||||
static tree decl_for_component_ref (tree);
|
static tree decl_for_component_ref (tree);
|
||||||
static int write_dependence_p (const_rtx, enum machine_mode, rtx, const_rtx,
|
static int write_dependence_p (const_rtx,
|
||||||
bool, bool);
|
const_rtx, enum machine_mode, rtx,
|
||||||
|
bool, bool, bool);
|
||||||
|
|
||||||
static void memory_modified_1 (rtx, const_rtx, void *);
|
static void memory_modified_1 (rtx, const_rtx, void *);
|
||||||
|
|
||||||
|
|
@ -2555,20 +2556,22 @@ canon_true_dependence (const_rtx mem, enum machine_mode mem_mode, rtx mem_addr,
|
||||||
|
|
||||||
/* Returns nonzero if a write to X might alias a previous read from
|
/* Returns nonzero if a write to X might alias a previous read from
|
||||||
(or, if WRITEP is true, a write to) MEM.
|
(or, if WRITEP is true, a write to) MEM.
|
||||||
If MEM_CANONCALIZED is nonzero, CANON_MEM_ADDR is the canonicalized
|
If X_CANONCALIZED is true, then X_ADDR is the canonicalized address of X,
|
||||||
address of MEM, and MEM_MODE the mode for that access. */
|
and X_MODE the mode for that access.
|
||||||
|
If MEM_CANONICALIZED is true, MEM is canonicalized. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
write_dependence_p (const_rtx mem, enum machine_mode mem_mode,
|
write_dependence_p (const_rtx mem,
|
||||||
rtx canon_mem_addr, const_rtx x,
|
const_rtx x, enum machine_mode x_mode, rtx x_addr,
|
||||||
bool mem_canonicalized, bool writep)
|
bool mem_canonicalized, bool x_canonicalized, bool writep)
|
||||||
{
|
{
|
||||||
rtx x_addr, mem_addr;
|
rtx mem_addr;
|
||||||
rtx base;
|
rtx base;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
gcc_checking_assert (mem_canonicalized ? (canon_mem_addr != NULL_RTX)
|
gcc_checking_assert (x_canonicalized
|
||||||
: (canon_mem_addr == NULL_RTX && mem_mode == VOIDmode));
|
? (x_addr != NULL_RTX && x_mode != VOIDmode)
|
||||||
|
: (x_addr == NULL_RTX && x_mode == VOIDmode));
|
||||||
|
|
||||||
if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
|
if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -2593,17 +2596,21 @@ write_dependence_p (const_rtx mem, enum machine_mode mem_mode,
|
||||||
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
|
if (MEM_ADDR_SPACE (mem) != MEM_ADDR_SPACE (x))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
x_addr = XEXP (x, 0);
|
|
||||||
mem_addr = XEXP (mem, 0);
|
mem_addr = XEXP (mem, 0);
|
||||||
if (!((GET_CODE (x_addr) == VALUE
|
if (!x_addr)
|
||||||
&& 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);
|
x_addr = XEXP (x, 0);
|
||||||
mem_addr = get_addr (mem_addr);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
base = find_base_term (mem_addr);
|
base = find_base_term (mem_addr);
|
||||||
|
|
@ -2619,17 +2626,16 @@ write_dependence_p (const_rtx mem, enum machine_mode mem_mode,
|
||||||
GET_MODE (mem)))
|
GET_MODE (mem)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
x_addr = canon_rtx (x_addr);
|
if (!x_canonicalized)
|
||||||
if (mem_canonicalized)
|
|
||||||
mem_addr = canon_mem_addr;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
mem_addr = canon_rtx (mem_addr);
|
x_addr = canon_rtx (x_addr);
|
||||||
mem_mode = GET_MODE (mem);
|
x_mode = GET_MODE (x);
|
||||||
}
|
}
|
||||||
|
if (!mem_canonicalized)
|
||||||
|
mem_addr = canon_rtx (mem_addr);
|
||||||
|
|
||||||
if ((ret = memrefs_conflict_p (GET_MODE_SIZE (mem_mode), 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;
|
return ret;
|
||||||
|
|
||||||
if (nonoverlapping_memrefs_p (x, mem, false))
|
if (nonoverlapping_memrefs_p (x, mem, false))
|
||||||
|
|
@ -2643,20 +2649,23 @@ write_dependence_p (const_rtx mem, enum machine_mode mem_mode,
|
||||||
int
|
int
|
||||||
anti_dependence (const_rtx mem, const_rtx x)
|
anti_dependence (const_rtx mem, const_rtx x)
|
||||||
{
|
{
|
||||||
return write_dependence_p (mem, VOIDmode, NULL_RTX, x,
|
return write_dependence_p (mem, x, VOIDmode, NULL_RTX,
|
||||||
/*mem_canonicalized=*/false, /*writep=*/false);
|
/*mem_canonicalized=*/false,
|
||||||
|
/*x_canonicalized*/false, /*writep=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Likewise, but we already have a canonicalized MEM_ADDR for MEM.
|
/* Likewise, but we already have a canonicalized MEM, and X_ADDR for X.
|
||||||
Also, consider MEM in MEM_MODE (which might be from an enclosing
|
Also, consider X in X_MODE (which might be from an enclosing
|
||||||
STRICT_LOW_PART / ZERO_EXTRACT). */
|
STRICT_LOW_PART / ZERO_EXTRACT).
|
||||||
|
If MEM_CANONICALIZED is true, MEM is canonicalized. */
|
||||||
|
|
||||||
int
|
int
|
||||||
canon_anti_dependence (const_rtx mem, enum machine_mode mem_mode,
|
canon_anti_dependence (const_rtx mem, bool mem_canonicalized,
|
||||||
rtx mem_addr, const_rtx x)
|
const_rtx x, enum machine_mode x_mode, rtx x_addr)
|
||||||
{
|
{
|
||||||
return write_dependence_p (mem, mem_mode, mem_addr, x,
|
return write_dependence_p (mem, x, x_mode, x_addr,
|
||||||
/*mem_canonicalized=*/true, /*writep=*/false);
|
mem_canonicalized, /*x_canonicalized=*/true,
|
||||||
|
/*writep=*/false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Output dependence: X is written after store in MEM takes place. */
|
/* Output dependence: X is written after store in MEM takes place. */
|
||||||
|
|
@ -2664,8 +2673,9 @@ canon_anti_dependence (const_rtx mem, enum machine_mode mem_mode,
|
||||||
int
|
int
|
||||||
output_dependence (const_rtx mem, const_rtx x)
|
output_dependence (const_rtx mem, const_rtx x)
|
||||||
{
|
{
|
||||||
return write_dependence_p (mem, VOIDmode, NULL_RTX, x,
|
return write_dependence_p (mem, x, VOIDmode, NULL_RTX,
|
||||||
/*mem_canonicalized=*/false, /*writep=*/true);
|
/*mem_canonicalized=*/false,
|
||||||
|
/*x_canonicalized*/false, /*writep=*/true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1837,7 +1837,7 @@ check_dependence (rtx *x, void *data)
|
||||||
{
|
{
|
||||||
struct check_dependence_data *d = (struct check_dependence_data *) data;
|
struct check_dependence_data *d = (struct check_dependence_data *) data;
|
||||||
if (*x && MEM_P (*x))
|
if (*x && MEM_P (*x))
|
||||||
return canon_anti_dependence (d->exp, d->mode, d->addr, *x);
|
return canon_anti_dependence (*x, true, d->exp, d->mode, d->addr);
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2263,8 +2263,8 @@ cselib_invalidate_mem (rtx mem_rtx)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (num_mems < PARAM_VALUE (PARAM_MAX_CSELIB_MEMORY_LOCATIONS)
|
if (num_mems < PARAM_VALUE (PARAM_MAX_CSELIB_MEMORY_LOCATIONS)
|
||||||
&& ! canon_anti_dependence (mem_rtx, GET_MODE (mem_rtx),
|
&& ! canon_anti_dependence (x, false, mem_rtx,
|
||||||
mem_addr, x))
|
GET_MODE (mem_rtx), mem_addr))
|
||||||
{
|
{
|
||||||
has_mem = true;
|
has_mem = true;
|
||||||
num_mems++;
|
num_mems++;
|
||||||
|
|
|
||||||
|
|
@ -2705,8 +2705,8 @@ extern int canon_true_dependence (const_rtx, enum machine_mode, rtx,
|
||||||
const_rtx, rtx);
|
const_rtx, rtx);
|
||||||
extern int read_dependence (const_rtx, const_rtx);
|
extern int read_dependence (const_rtx, const_rtx);
|
||||||
extern int anti_dependence (const_rtx, const_rtx);
|
extern int anti_dependence (const_rtx, const_rtx);
|
||||||
extern int canon_anti_dependence (const_rtx, enum machine_mode, rtx,
|
extern int canon_anti_dependence (const_rtx, bool,
|
||||||
const_rtx);
|
const_rtx, enum machine_mode, rtx);
|
||||||
extern int output_dependence (const_rtx, const_rtx);
|
extern int output_dependence (const_rtx, const_rtx);
|
||||||
extern int may_alias_p (const_rtx, const_rtx);
|
extern int may_alias_p (const_rtx, const_rtx);
|
||||||
extern void init_alias_target (void);
|
extern void init_alias_target (void);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue