https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80574
--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #9) > One thing I noticed is that: > _2 = MAX_EXPR <_6, a3_7(D)>; > _3 = MAX_EXPR <_2, a3_7(D)>; > > Is not optimized at all. > > (for minmax (min max) > (simplify > (minmax:c (minmax:c@2 @0 @1) @0) > @2)) Submitted the patch for that as https://gcc.gnu.org/pipermail/gcc-patches/2023-July/625135.html . Note after that patch we get decent code for the original testcases but it is not fully optimized at the gimple level.