Hi, This is a experimental fix for pr94274. For if/else structure, when the expressions is binary operation and have a common subexpression, and the opcode is the same, we can fold the merging phi node in tree_ssa_phiopt_worker (ssa-phiopt). It can be optimized to do csel first and then do binary operations. This can eliminate one or more instructions. And this patch is effective for 500.perlbench_r in spec2017. Bootstrap and tested on aarch64/x86_64 Linux platform. No new regression witnessed.
Any suggestion? Thanks, Haijian Zhang
pr94274-v1.diff
Description: pr94274-v1.diff