Hello,
here is a new version of the ifcombine patch, which handles Andrew's examples
(though only with -O2 for one of them, same_phi_args_p returns false
otherwise).
Note that the new patch never calls maybe_fold_or_comparisons, only
maybe_fold_and_comparisons. It would be possible to call
maybe_fold_or_comparisons, when maybe_fold_and_comparisons fails, but I don't
know if there are optimizations that one does and not the other, except for
the odd trapping-math case.
Bootstrap and testsuite are fine.
2012-07-26 Marc Glisse <marc.glisse@inria.fr>
gcc/
PR tree-optimization/51938
PR tree-optimization/52005
* tree-ssa-ifcombine.c (ifcombine_ifandif): New parameters for
inverted conditions.
(ifcombine_iforif): Remove, merge code into ifcombine_ifandif.
(tree_ssa_ifcombine_bb): Update calls to the above. Detect !a&&b
and !a||b patterns.
gcc/testsuite/
PR tree-optimization/51938
PR tree-optimization/52005
* gcc.dg/tree-ssa/ssa-ifcombine-8.c: New testcase.
* gcc.dg/tree-ssa/ssa-ifcombine-9.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-10.c: Likewise.
* gcc.dg/tree-ssa/ssa-ifcombine-11.c: Likewise.