https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101895

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jeffrey A. Law from comment #3)
> Understood WRT phase ordering.  That was fully expected.
> 
> What I still don't understand is why moving the permute down is profitable
> here or generally why moving a permute into a dependency chain is profitable.
> 
> ISTM that hoisting a permute up a dependency chain so that it's fed by a
> load is profitable.  Similarly sinking a permute to the end of a dependency
> chain so that it feeds a store is profitable.  Moving a permute so that it
> feeds or is fed by another permute is probably profitable too.  Otherwise
> moving a permute into the middle of a dependency chain seems like a
> pessimization.

Yes, I agree.  As said vect_optimize_slp misses a part that pushes the
permutes back towards the loads.  At the moment it is designed to
move everything towards the stores (or reductions) with the intend to
get rid of them.  If that doesn't succeed the final placement of the
permutes isn't optimized - only the number of permutes is.

Reply via email to