On Tue, Jan 24, 2012 at 2:50 AM, Richard Guenther <richard.guent...@gmail.com> wrote: > On Tue, Jan 24, 2012 at 7:34 AM, Andrew Pinski > <andrew.pin...@caviumnetworks.com> wrote: >> Hi, >> Right now PHI-OPT does try to handle the case where we have multiple >> PHIs but the other PHIs have the same value for the edges we care >> about. >> This fixes the issue and allows PHI-OPT to handle a few more cases and >> it removes the TODO in the comments. >> >> OK For 4.8? Bootstrapped and tested on x86_64-linux-gnu with no regressions. >> >> Thanks, >> Andrew Pinski >> >> ChangeLog: >> * tree-ssa-phiopt.c (gimple_phi_singleton_for_edges): New function. > > The name is confusing I think, because it returns the single non-singleton > PHI for the edge pair ... you can avoid choosing a better name by > inlining it to its single call site. I'd maybe name it > single_non_singleton_phi_for_edges. > > Otherwise ok.
Here is the updated patch with one small change, value_replacement uses single_non_singleton_phi_for_edges now too. OK still? Bootstrapped and tested on x86_64-linux-gnu with no regressions. Thanks, Andrew Pinski ChangeLog: * tree-ssa-phiopt.c (single_non_singleton_phi_for_edges): New function. (tree_ssa_phiopt_worker): Use single_non_singleton_phi_for_edges. (value_replacement): Likewise. (empty_block_p): Check also if the PHIs for the block are empty. testsuite/ChangeLog: * gcc.dg/tree-ssa/phi-opt-7.c: New testcase. > > Thanks, > Richard. > >> (tree_ssa_phiopt_worker): Use gimple_phi_singleton_for_edges. >> (empty_block_p): Check also if the PHIs for the block are empty. >> >> testsuite/ChangeLog: >> * gcc.dg/tree-ssa/phi-opt-7.c: New testcase.