On 6/17/2026 10:49 PM, Andrew Pinski wrote:
> This extends the factor_out_conditional_load to support non-zero offsets
> for the MEM_REF. And fixes PR 122193.
> It tries not to create gimple statements that don't need to be created.
> E.g. If the base is the same then it creates the pointer plus in the join
> bb rather than the in the middle bbs. Also uses gimple_build for the pointer
> plus so that the if one of the offsets was 0, a new statement is not created.
>
> Bootstrapped and tested on x86_64-linux-gnu.
>
> This patch depends on the patch which adds factor_out_conditional_load.
>
>       PR tree-optimization/122193
> gcc/ChangeLog:
>
>       * tree-ssa-phiopt.cc (factor_out_conditional_load): Support non-zero
>       offsets.
>
> gcc/testsuite/ChangeLog:
>
>       * gcc.dg/tree-ssa/factor_op_phi-load-offsets-1.c: New test.
>       * gcc.dg/tree-ssa/factor_op_phi-load-offsets-2.c: New test.
>       * gcc.dg/tree-ssa/factor_op_phi-load-offsets-3.c: New test.
OK.   I have a strong suspicion that this likely fixes at least one 
other missed-optimization bug in the testsuite, I guess we'll find it at 
some point during our scans over missed-optimization bugs.

Jeff

Reply via email to