On Fri, Mar 8, 2019 at 1:34 AM Bill Schmidt <wschm...@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 <wschm...@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 ()); >