On Sun, Nov 6, 2011 at 11:17 PM, Kai Tietz <kti...@redhat.com> wrote: > Hello, > > the second patch extends the tree-ssa-ifcombine pass so, that it chains up > simple if-and/or-if patterns via associative bitwise-and/or operations. This > allows for example optimization for cases like: > > if (c == 0) return 2; > if (c == 1) return 2; > if (c == 2) return 2; > ... > > as now reassociation-pass can optimize on them.
err ... tree-ssa-ifcombine does exactly if "merging", why are you now adding a "merging" part!? The above description does not shed any light on this either. In fact the above example is something that should be optimized by phiopt. Richard. > ChangeLog > > 2011-11-06 Kai Tietz <kti...@redhat.com> > > * tree-ssa-ifcombine.c (remove_stmt_chain): New helper. > (update_gimple_cond_condtion_from_tree): Likewise. > (stmt_no_side_effects_p): Likewise. > (bb_no_side_effects_p): Use stmt_no_side_effects_p. > (bb_no_side_effects_p_2): New helper function. > (same_phi_args_p_2): Likewise. > (recognize_single_bit_test): Allow equal and not-equal > comparison handling. > (ifcombine_ifandif): Handle equal and not-equal > (X & CST) !=/== 0 optimization. > (ifcombine_ifandif_merge): New helper for tree_ssa_ifmerge_bb. > (ifcombine_iforif_merge): Likewise. > (ifcombine_iforif): Simplify routine. > (tree_ssa_ifmerge_bb): New helper for doing if-branch merging. > (tree_ssa_ifcombine_bb): Adjust pattern-searching for iforif > and ifandif. > (tree_ssa_ifcombine): Add if-branch merging and allow > multiple folding for if-combining. > > ChangeLog testsuite > > 2011-11-06 Kai Tietz <kti...@redhat.com> > > * gcc.dg/tree-ssa/phi-opt-2.c: Adjust test. > * gcc.dg/tree-ssa/ifcombine-8.c: New test. > * gcc.dg/tree-ssa/ifcombine-9.c: New test. > * gcc.dg/tree-ssa/ifcombine-10.c: New test. > * gcc.dg/tree-ssa/ifcombine-11.c: New test. > * gcc.dg/tree-ssa/ifcombine-12.c: New test. > > > Bootstrapped and regression-tested for x86_64-unknown-linux-gnu for all > languages (include Ada and Obj-C++). Ok for apply? > > Regards, > Kai >