This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix gimple_fold_stmt_to_constant regression
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Richard Biener <rguenther at suse dot de>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sat, 15 Nov 2014 15:03:18 -0800
- Subject: Re: [PATCH] Fix gimple_fold_stmt_to_constant regression
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1411141338380 dot 374 at zhemvz dot fhfr dot qr>
On Fri, Nov 14, 2014 at 4:39 AM, Richard Biener <rguenther@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 <rguenther@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.