This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix DSE (PR middle-end/39794)


> 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;
  else
    {
      group_info_t group = VEC_index (group_info_t, rtx_group_vec, group_id);
      mem_addr = group->base;
    }

 if (offset)
   mem_addr = plus_constant (mem_addr, offset);

and changing

  /* The result of get_addr on mem.  */
  rtx mem_addr;

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  <jakub@redhat.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.

PR rtl-optimization/39794

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]