On 6/4/2026 11:42 PM, Andrew Pinski wrote:
> r17-1273-g391ee229b737eb added support for the case where the middle bb was
> non-empty but
> with a trailing store. This meant if there was a load in the middle bb, it
> might cause
> nontrapping to have the lhs in it. So we now need to check for a load in the
> middle-bb
> to reject this case.
>
> Bootstrapped and tested on x86_64-linux-gnu.
>
> PR tree-optimization/125612
>
> gcc/ChangeLog:
>
> * tree-ssa-phiopt.cc (cond_store_replacement): For the case where
> lhs is "known" to be nontrapping make sure there are no loads in
> the middle bb.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.dg/tree-ssa/pr125612-1.c: New test.
OK.
Jeff