https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115710
--- Comment #13 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrew Pinski <pins...@gcc.gnu.org>: https://gcc.gnu.org/g:d8fe4f05ef448e6a136398d38c0f2170d3c6bb0d commit r15-1797-gd8fe4f05ef448e6a136398d38c0f2170d3c6bb0d Author: Andrew Pinski <quic_apin...@quicinc.com> Date: Sun Jun 30 12:57:14 2024 -0700 Move cabs expansion from powcabs to complex lowering [PR115710] Expanding cabs in powcab might be too late as forwprop might recombine the load from a memory with the complex expr. Moving instead to complex lowering allows us to use directly the real/imag component from the loads instead. This allows for vectorization too. Bootstrapped and tested on x86_64-linux-gnu with no regressions. PR tree-optimization/115710 gcc/ChangeLog: * tree-complex.cc (init_dont_simulate_again): Handle CABS. (gimple_expand_builtin_cabs): New function, moved mostly from tree-ssa-math-opts.cc. (expand_complex_operations_1): Call gimple_expand_builtin_cabs. * tree-ssa-math-opts.cc (gimple_expand_builtin_cabs): Remove. (build_and_insert_binop): Remove. (pass_data_expand_powcabs): Update comment. (pass_expand_powcabs::execute): Don't handle CABS. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/cabs-1.c: New test. * gcc.dg/tree-ssa/cabs-2.c: New test. * gfortran.dg/vect/pr115710.f90: New test. Signed-off-by: Andrew Pinski <quic_apin...@quicinc.com>