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".
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?
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.
So OK as-is if you really wanted the COMPLEX_EXPR to have a single use.
Or OK after removing that test.
Jeff