This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix DSE (PR middle-end/39794)
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Apr 2009 17:11:23 +0200
- Subject: Re: [PATCH] Fix DSE (PR middle-end/39794)
- References: <20090422111700.GD4664@tyan-ft48-01.lab.bos.redhat.com>
> Seems sched-deps.c uses cselib_subst_to_values for these purposes, so if
> the REGs mentioned in the MEM actually change in between, the addresses are
> different and thus canon_true_dependence does the right thing.
sched-deps.c doesn't store cselib values locally whereas dse.c does though.
What about something like:
if (spill_alias_set || group_id < 0)
mem_addr = base->val_rtx;
group_info_t group = VEC_index (group_info_t, rtx_group_vec, group_id);
mem_addr = group->base;
mem_addr = plus_constant (mem_addr, offset);
/* The result of get_addr on mem. */
so that get_addr is precisely _not_ called on mem_addr.
> The remaining canon_true_dependence in scan_reads_nospill is I think fine,
> group->canon_base_mem in that case is either a constant address, or frame
> related and so if registers in read_info->mem change over the life time
> of the function, group->canon_base_mem does not and so
> canon_true_dependence should IMHO return the right thing.
group->canon_base_mem is a MEM, not an address:
gi->base_mem = gen_rtx_MEM (QImode, base);
gi->canon_base_mem = canon_rtx (gi->base_mem);
so it's wrong too, but differently.
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk
> (and after a while for 4.4 as well)?
I'd even consider it for the 4.3 branch since the reporter has managed to come
up with a testcase for 4.3.3, but it's up to you.
> 2009-04-21 Jakub Jelinek <email@example.com>
> PR middle-end/39794
> * alias.c (canon_true_dependence): Add x_addr argument.
> * rtl.h (canon_true_dependence): Adjust prototype.
> * cse.c (check_dependence): Adjust canon_true_dependence callers.
> * cselib.c (cselib_invalidate_mem): Likewise.
> * gcse.c (compute_transp): Likewise.
> * dse.c (scan_reads_nospill): Likewise.
> (record_store, check_mem_read_rtx): Likewise. For non-const or
> frame addresses pass cselib_subst_to_values as mem_addr, for
> const or frame addresses canon_base_mem of the group plus
> optionally offset.