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

--- Comment #4 from Zhongyao Chen <chenzhongyao.hit at gmail dot com> ---
(In reply to [email protected] from comment #3)
> The swapping in vect_build_slp_tree_2 should have covered this case:
> 
>       /* If the SLP build for operand zero failed and operand zero
>          and one can be commuted try that for the scalar stmts
>          that failed the match.  */
>       if (i == 0
>           /* A first scalar stmt mismatch signals a fatal mismatch.  */
>           && matches[0]
> 
> but it might be that if, for BB vect, operand zero was SLP discvered
> as external, operand one discovery could be still fixed by operand
> swapping.  Is that the case here?  

Yes, exactly what happens here.

> It's going to be a bit awkward
> to handle this here, but basically we might want to avoid building
> an operand from scalars (aka external) upon failure when upstream
> could still perform operand swapping.

ok, then we can avoid it here if it can satisfy the existing retry-swap patch
preconditions. that would need extract a shared helper from current retry-swap
path and use it before "build from scalars".

Reply via email to