On Mon, 24 Jul 2023, Richard Sandiford wrote:

> Richard Biener <rguent...@suse.de> writes:
> > The following unifies SLP_TREE_VEC_STMTS into SLP_TREE_VEC_DEFS
> > which can handle all cases we need.
> >
> > Bootstrap & regtest running on x86_64-unknown-linux-gnu.
> 
> Nice!  Just curious...
> 
> > @@ -149,6 +147,20 @@ _slp_tree::~_slp_tree ()
> >      free (failed);
> >  }
> >  
> > +/* Push the single SSA definition in DEF to the vector of vector defs.  */
> > +
> > +void
> > +_slp_tree::push_vec_def (gimple *def)
> > +{
> > +  if (gphi *phi = dyn_cast <gphi *> (def))
> > +    vec_defs.quick_push (gimple_phi_result (phi));
> > +  else
> > +    {
> > +      def_operand_p defop = single_ssa_def_operand (def, SSA_OP_ALL_DEFS);
> > +      vec_defs.quick_push (get_def_from_ptr (defop));
> > +    }
> > +}
> 
> ...what does this handle that gimple_get_lhs wouldn't?  asms?

I was worried about stores where this would pick up the virtual
definition.  But double-checking reveals we don't push vector
defs in vectorizable_store for SLP.  I haven't made up my mind
whether we should (for consistency).  It also makes sure we
don't end up with calls with a LHS and a virtual definition - that's
what we eventually are going to trip over here.

In principle when there's no 'LHS' we can use any SSA def.

That said, I'm not sure either, just wanted to make a few cases
more to work in odd code we might have here or there ...

Btw, the above function is eventually going to be legacy though
currently it's the most used.

Richard.

Reply via email to