http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51938
--- Comment #5 from Marc Glisse <glisse at gcc dot gnu.org> 2012-06-08 13:06:52 UTC --- The main difficulty is trapping math. It isn't hard to add to tree-ssa-ifcombine an ifcombine_ifnotandif variant, and we could make it call maybe_fold_and_comparisons (as ifcombine_ifandif does) with invert_tree_comparison (gimple_cond_code (outer_cond),...), but unless we pass -fno-trapping-math, it won't help. combine_comparisons (fold-const.c) has relevant code to determine whether the optimization is safe wrt trapping, but it does so with the semantic that UNLT_EXPR never traps, whereas I am (wrongfully) using it for TRUTH_NOT_EXPR(GE_EXPR). So I guess that means two more versions of maybe_fold_and_comparisons/maybe_fold_or_comparisons are needed :-(