This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] rs6000: Fix lost ud chains in swap optimization
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Bill Schmidt <wschmidt at linux dot ibm dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Segher Boessenkool <segher at kernel dot crashing dot org>
- Date: Fri, 8 Mar 2019 11:40:34 +0100
- Subject: Re: [PATCH] rs6000: Fix lost ud chains in swap optimization
- References: <08b57042-de7e-bf70-9468-cb0ee04c4963@linux.ibm.com>
On Fri, Mar 8, 2019 at 1:34 AM Bill Schmidt <wschmidt@linux.ibm.com> wrote:
>
> Hi,
>
> We recently discovered a problem in swap optimization where the du- and ud-chains
> were getting corrupted after a preliminary modification phase and prior to the
> main body of the pass. The fix for this is to rebuild the chains between phases.
It looks expensive - is it possible to keep them up-to-date instead?
> Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions.
> I've not included a test case because the problem tends to get lost in reduction,
> and may shift over time anyway. Is this okay for trunk, and eventual backport
> to 8 and 7?
>
> Thanks!
>
> Bill
>
>
> 2019-03-07 Bill Schmidt <wschmidt@linux.ibm.com>
>
> * config/rs6000/rs6000-p8swap.c (rs6000_analyze_swaps): Rebuild
> ud- and du-chains between phases.
>
>
> Index: gcc/config/rs6000/rs6000-p8swap.c
> ===================================================================
> --- gcc/config/rs6000/rs6000-p8swap.c (revision 269471)
> +++ gcc/config/rs6000/rs6000-p8swap.c (working copy)
> @@ -2316,7 +2316,14 @@ rs6000_analyze_swaps (function *fun)
>
> /* Pre-pass to recombine lvx and stvx patterns so we don't lose info. */
> recombine_lvx_stvx_patterns (fun);
> +
> + /* Rebuild ud- and du-chains. */
> + df_remove_problem (df_chain);
> df_process_deferred_rescans ();
> + df_set_flags (DF_RD_PRUNE_DEAD_DEFS);
> + df_chain_add_problem (DF_DU_CHAIN | DF_UD_CHAIN);
> + df_analyze ();
> + df_set_flags (DF_DEFER_INSN_RESCAN);
>
> /* Allocate structure to represent webs of insns. */
> insn_entry = XCNEWVEC (swap_web_entry, get_max_uid ());
>