[PATCH] fwprop: Fix single_use_p calculation

Ilya Leoshkevich iii@linux.ibm.com
Mon Mar 22 20:48:17 GMT 2021


On Mon, 2021-03-22 at 18:23 +0000, Richard Sandiford wrote:
> Ilya Leoshkevich <iii@linux.ibm.com> writes:

[...]

> > Do you still want me to add single_nondebug_use() for completeness
> > in
> > this patch, or would it be better to add it later when it's
> > actually
> > needed?
> 
> I was thinking that the fwprop.c code would use
> def->single_nondebug_use () instead of
> def->single_nondebug_insn_use () && !def->has_phi_uses ().

But these two are not equivalent, are they?  single_nondebug_use()
that you proposed explicitly allows phis:

  // If there is exactly one nondebug use of the set's result,
  // return that use, otherwise return null.  The use might be in
  // instruction or a phi node.
  use_info *single_nondebug_use () const;

but I don't think we want to propagate into phis here.
Or should the check be a bit bigger, like the following?

use_info *single = def->single_nondebug_use ();
single_use_p = single && !single->is_in_phi ();


[...]

Best regards,
Ilya



More information about the Gcc-patches mailing list