[PATCH][compare-elim] Fix PR rtl-optimization/82597

Jakub Jelinek jakub@redhat.com
Wed Nov 1 13:40:00 GMT 2017


On Wed, Nov 01, 2017 at 02:32:02PM +0100, Eric Botcazou wrote:
> > 2017-10-31  Jakub Jelinek  <jakub@redhat.com>
> > 
> > 	PR rtl-optimization/82778
> > 	PR rtl-optimization/82597
> > 	* compare-elim.c (struct comparison): Add in_a_setter field.
> > 	(find_comparison_dom_walker::before_dom_children): Remove killed
> > 	bitmap and df_simulate_find_defs call, instead walk the defs.
> > 	Compute last_setter and initialize in_a_setter.  Merge definitions
> > 	with first initialization for a few variables.
> > 	(try_validate_parallel): Use insn_invalid_p instead of
> > 	recog_memoized.  Return insn rather than just the pattern.
> > 	(try_merge_compare): Fix up comment.  Don't uselessly test if
> > 	in_a is a REG_P.  Use cmp->in_a_setter instead of walking UD
> > 	chains.
> > 
> > 	* g++.dg/opt/pr82778.C: New test.
> > 
> > 2017-10-31  Michael Collison  <michael.collison@arm.com>
> > 
> > 	PR rtl-optimization/82597
> > 	* gcc.dg/pr82597.c: New test.
> 
> That's a clear progress, but the patch doesn't fully get rid of use-def and 
> def-use chains, does it?

I believe it does fully get rid of use-def and def-use chains in
compare-elim.c.  The DU and UD chains are still in ree.c and haifa-sched.c
and UD chains only in dce.c, loop-invariant.c, loop-iv.c and web.c.

At least, the only spot that used to mention df_link in compare-elim.c was:
  struct df_link *ref_chain;
  ref_chain = DF_REF_CHAIN (use);
  if (!ref_chain || !ref_chain->ref
      || !DF_REF_INSN_INFO (ref_chain->ref) || ref_chain->next != NULL)
    return false;

  rtx_insn *def_insn = DF_REF_INSN (ref_chain->ref);
and
  df_chain_add_problem (DF_UD_CHAIN + DF_DU_CHAIN);
that ensured it is computed, but the former is replaced with the patch by
  rtx_insn *def_insn = cmp->in_a_setter;
which is computed during the bb walking using the last_setter array
and the latter is dropped.

	Jakub



More information about the Gcc-patches mailing list