On Sat, 11 Mar 2023, Jeff Law wrote:

> 
> 
> On 3/7/23 04:08, Richard Biener via Gcc-patches wrote:
> > The following addresses PR109046 by adding an optimization to forwprop
> > to combine a piecewise complex load to a complex load when there are
> > no uses of the components.  That's something useful in general and
> > easier to do than avoiding the splitting in complex lowering.
> Presumably instead of "no uses of the components" you meant to say "no other
> uses of the components".

Yes, will reword.

> > 
> > The testcase exercises both the manual and the complex lowering case.
> > 
> > Bootstrapped and tested on x86_64-unknown-linux-gnu, OK?
> > 
> > Thanks,
> > Richard.
> > 
> >  PR tree-optimization/109046
> >  * tree-ssa-forwprop.cc (pass_forwprop::execute): Combine
> >  piecewise complex loads.
> > 
> >     * gcc.dg/tree-ssa/forwprop-39.c: New testcase.
> > ---
> 
> [ ... ]
> > +         /* Rewrite a component-wise load of a complex to a complex
> > +            load if the components are not used separately.  */
> > +         else if (TREE_CODE (rhs) == SSA_NAME
> > +                  && has_single_use (rhs)
> Did you really meant to test that RHS is single use?  Isn't that the
> COMPLEX_EXPR here?  It would seem fine to me to allow multiple uses of the
> COMPLEX_EXPR itself.  Am I missing something?

Yeah, rhs is actually rhs1, the first operand of the COMPLEX_EXPR ...

> The only conceptual concern I have would be volatile objects.  But in that
> case were're replacing a piecewise load of the volatile with a single complex
> load.  That probably better matches what the developer expected anyway.

Ah, but good that you notice - we shouldn't do this combination for 
volatile component loads.

I'll adjust accordingly re-test and commit.

> So OK as-is if you really wanted the COMPLEX_EXPR to have a single use. Or OK
> after removing that test.

Thanks,
Richard.

Reply via email to