https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116815
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Last reconfirmed| |2024-09-23 Ever confirmed|0 |1 Component|target |middle-end --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- The easiest way to fix this is transform (late in gimple): _1 = a_2(D) + b_3(D); _5 = MAX_EXPR <_1, a_2(D)>; into: _tmp = .ADD_OVERFLOW (a_2(D), b_3(D)); _tmp1 = IMAGPART_EXPR <_tmp>; _tmp2 = _tmp1 != 0; _tmp3 = REALPART_EXPR <_tmp>; _5 = _tmp2 ? _tmp3 : a_2(D); If we have addc support. Likewise the others. Which should be too hard to add to tree-ssa-math-opts.cc with the other ADD_OVERFLOW optimizations.