https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116815
--- Comment #2 from ktkachov at gcc dot gnu.org --- (In reply to Andrew Pinski from comment #1) > 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. Did you meant to say "shouldn't be too hard" here?