1) if (X & (1 << a)) if (X & (1 << b)) should be combined to tmp = (1 << a) | (1 << b) if (X & tmp == tmp) 2) if (X & a) goto doit; else if (X & b) goto doit doit: (i.e. the CFG form of (X & a || X & b)) should be combined to if (X & (a | b)) goto doit The first form happens in SPEC2k6 libquantum hottest loop. The patch I have for this should also be made to address PR15353.
Subject: Bug 31657 Author: rguenth Date: Tue Jun 12 12:06:19 2007 New Revision: 125644 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=125644 Log: 2007-06-12 Richard Guenther <rguenther@suse.de> PR tree-optimization/15353 PR tree-optimization/31657 * passes.c (init_optimization_passes): Add pass_tree_ifcombine. * timevar.def: Add TV_TREE_IFCOMBINE. * tree-pass.h (pass_tree_ifcombine): Declare. * tree-ssa-ifcombine.c: New file. * tree-ssa-phiopt.c (blocks_in_phiopt_order): Export. * tree-flow.h (blocks_in_phiopt_order): Declare. * Makefile.in (OBJS-common): Add tree-ssa-ifcombine.o. (tree-ssa-ifcombine.o): New dependencies. * gcc.c-torture/execute/20070424-1.c: New testcase. * gcc.dg/tree-ssa/ssa-ifcombine-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-4.c: Likewise. * gcc.dg/tree-ssa/ssa-ifcombine-5.c: Likewise. Added: trunk/gcc/testsuite/gcc.c-torture/execute/20070424-1.c trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-1.c trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-2.c trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-3.c trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-4.c trunk/gcc/testsuite/gcc.dg/tree-ssa/ssa-ifcombine-5.c trunk/gcc/tree-ssa-ifcombine.c Modified: trunk/gcc/ChangeLog trunk/gcc/Makefile.in trunk/gcc/passes.c trunk/gcc/testsuite/ChangeLog trunk/gcc/timevar.def trunk/gcc/tree-flow.h trunk/gcc/tree-pass.h trunk/gcc/tree-ssa-phiopt.c
Fixed.