https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107888
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I think this should not be hard to add to minmax_from_comparison I think. Though right now we don't call it for the non-constant case but that should be easy to fix I think.