On Fri, Nov 14, 2014 at 4:39 AM, Richard Biener <rguent...@suse.de> wrote: > > Following up https://gcc.gnu.org/ml/gcc-patches/2014-10/msg01233.html and > fixing the regressions this caused as soon as I removed the dispatch > to fold_unary (and more regressions it would have caused if I managed > to finish the idea to also remove the dispatches to fold_binary > and fold_ternary...) the following patch makes CCP and VRP follow > selected SSA edges again when gimple_fold_stmt_to_constant_1 > dispatches to gimple_simplify. > > The valueization for gimple_simplify of SSA propagator users may > both valueize to anything (in particular constants) and it may > signal to follow SSA edges if the destination will never be > visited again by the propagator (thus its lattice value is stable). > Esp. cutting out valueizing SSA names to constants is what caused > the regressions. > > Note that this highlights the fact that overloading the valueization > result with the signal to (not) follow SSA edges isn't the very > best thing to do - for example we can't valueize to a SSA name > (like for looking through SSA copies) but at the same time say > that gimple_simplify shouldn't follow the edge to its definition. > This shouldn't be a serious limitation for CCP and VRP which > care about constants only - but it shows a defect in the > gimple_simplify interface. I haven't yet concluded on a better > one though - options go from adding a secondary return to > the valueize hook to adding a second hook maybe with additionally > adding a simple flag to turn off SSA edge following globally. > > Anyway - the following patch should fix the immediate regression > and allows to go forward with removing GENERIC folding from > both fold_stmt and gimple_fold_stmt_to_constant. Just not > for this stage1 which will end too soon. > > Bootstrapped on x86_64-unknown-linux-gnu, testing in progress. > > Thanks, > Richard. > > 2014-11-14 Richard Biener <rguent...@suse.de> > > * gimple-fold.h (gimple_fold_stmt_to_constant_1): Add 2nd > valueization hook defaulted to no_follow_ssa_edges. > * gimple-fold.c (gimple_fold_stmt_to_constant_1): Pass > 2nd valueization hook to gimple_simplify. > * tree-ssa-ccp.c (valueize_op_1): New function to be > used for gimple_simplify called via gimple_fold_stmt_to_constant_1. > (ccp_fold): Adjust. > * tree-vrp.c (vrp_valueize_1): New function to be > used for gimple_simplify called via gimple_fold_stmt_to_constant_1. > (vrp_visit_assignment_or_call): Adjust. >
This caused: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63898 -- H.J.