https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126138
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The trunk branch has been updated by Andrea Pinski <[email protected]>: https://gcc.gnu.org/g:ea33efbbdcf69794b9962bf4926b07e73618d016 commit r17-2708-gea33efbbdcf69794b9962bf4926b07e73618d016 Author: Andrea Pinski <[email protected]> Date: Sat Jul 11 22:57:39 2026 -0700 ifcombine: Handle trapping ifcombining better. [PR126138] We can sometimes combine comparisons that are trapping. This adds that optimization to ifcombine; using combine_comparison from fold-const to do most of the work. This does not handle all cases though; mostly dealing with where we need an inversion of the outer comparison and it does not invert is not currently handled. This will be handled later on as it needs some extra code added to combine_comparisons. Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/126138 gcc/ChangeLog: * tree-ssa-ifcombine.cc (bb_no_side_effects_p): Don't reject GIMPLE_COND that can trap. (ifcombine_ifandif): Handle trapping inner conditional specially. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/fp-trapping-cmp-2.c: New test. * gcc.dg/tree-ssa/fp-trapping-cmp-3.c: New test. Signed-off-by: Andrea Pinski <[email protected]>
