This is the mail archive of the gcc-patches@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]

[Patch] PR 51938: extend ifcombine


Hello,

currently, tree-ssa-ifcombine handles pairs of imbricated "if"s that share the same then branch, or the same else branch. There is no particular reason why it couldn't also handle the case where the then branch of one is the else branch of the other, which is what I do here.

Any comments?


2012-06-10 Marc Glisse <marc.glisse@inria.fr>


gcc/
        PR tree-optimization/51938
	* fold-const.c (combine_comparisons): Extra argument. Handle inverted
	conditions.
        (fold_truth_andor_1): Update call to combine_comparisons.
        * gimple-fold.c (swap12): New function.
        (and_comparisons_1): Extra argument. Handle inverted conditions.
        (and_var_with_comparison_1): Update call to and_comparisons_1.
        (maybe_fold_and_comparisons): Extra argument. Update call to
	and_comparisons_1.
        (or_comparisons_1): Extra argument. Handle inverted conditions.
        (or_var_with_comparison_1): Update call to or_comparisons_1.
        (maybe_fold_or_comparisons): Extra argument. Update call to
	or_comparisons_1.
	* tree-ssa-ifcombine.c (ifcombine_ifnotandif): New function.
	(ifcombine_ifnotorif): New function.
	(tree_ssa_ifcombine_bb): Call them.
	(ifcombine_iforif): Update call to maybe_fold_or_comparisons.
	(ifcombine_ifandif): Update call to maybe_fold_and_comparisons.
	* tree-ssa-reassoc.c (eliminate_redundant_comparison): Update calls to
	maybe_fold_or_comparisons and maybe_fold_and_comparisons.
	* tree-if-conv.c (fold_or_predicates): Update call to
	maybe_fold_or_comparisons.
        * gimple.h (maybe_fold_and_comparisons): Match gimple-fold.c prototype.
        (maybe_fold_or_comparisons): Likewise.
        * tree.h (combine_comparisons): Match fold-const.c prototype.

gcc/testsuite/
        PR tree-optimization/51938
	* gcc.dg/tree-ssa/ssa-ifcombine-8.c: New testcase.
	* gcc.dg/tree-ssa/ssa-ifcombine-9.c: New testcase.



--
Marc Glisse

Attachment: P
Description: Text document


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