This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/51938] missed optimization: 2 comparisons


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 :-(


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]