On Sat, Jan 30, 2021 at 09:17:45AM +0100, Richard Biener wrote:
> >The following patch fixes it, ok for trunk if it passes
> >bootstrap/regtest?
> 
> Hmm, that's odd.  Who relies on deferred rescan being the default?  Finish
> pass, via processing deferred insns also resets it back.  Or is this
> documented somewhere?

Ifcvt clearly relies on non-deferred rescanning.
And yes, df_finish_pass clears df->changeable_flags, but we don't do that
for this pass anymore (removal of TODO_df_finish), as that pass didn't call
df_analyze either.
df_process_deferred_rescans temporarily clears DF_DEFER_INSN_RESCAN
flag, but restores it to the previous state at the end.

So, I think we either need what I posted (which passed bootstrap/regtest
on x86_64-linux and i686-linux), or we need to restore TODO_df_finish
for the pass.
Given that the pass previously did call df_analyze () only conditionally,
not at all in many functions, and had TODO_df_finish unconditionally,
perhaps that needs to work even if it wasn't meant to be used that way.

> >2021-01-29  Jakub Jelinek  <ja...@redhat.com>
> >
> >     * config/i386/i386-features.c (remove_partial_avx_dependency):
> >Remember
> >     whether DF_DEFER_INSN_RESCAN has been active before or not, and
> >     reset it to previous state.
> >
> >     * gcc.target/i386/20051216-1.c: New test.
> >
> >--- gcc/config/i386/i386-features.c.jj       2021-01-29 20:39:10.561912947
> >+0100
> >+++ gcc/config/i386/i386-features.c  2021-01-29 20:59:06.254740315 +0100
> >@@ -2273,7 +2273,7 @@ remove_partial_avx_dependency (void)
> >   auto_vec<rtx_insn *> control_flow_insns;
> > 
> >   /* We create invalid RTL initially so defer rescans.  */
> >-  df_set_flags (DF_DEFER_INSN_RESCAN);
> >+  int prev_df_flags = df_set_flags (DF_DEFER_INSN_RESCAN);
> > 
> >   FOR_EACH_BB_FN (bb, cfun)
> >     {
> >@@ -2409,6 +2409,8 @@ remove_partial_avx_dependency (void)
> >     }
> > 
> >   df_process_deferred_rescans ();
> >+  if ((prev_df_flags & DF_DEFER_INSN_RESCAN) == 0)
> >+    df_clear_flags (DF_DEFER_INSN_RESCAN);
> >   bitmap_obstack_release (NULL);
> >   BITMAP_FREE (convert_bbs);
> > 
> >--- gcc/testsuite/gcc.target/i386/20051216-1.c.jj    2021-01-29
> >21:06:20.386960652 +0100
> >+++ gcc/testsuite/gcc.target/i386/20051216-1.c       2021-01-29
> >21:03:17.599973093 +0100
> >@@ -0,0 +1,5 @@
> >+/* PR rtl-optimization/25432 */
> >+/* { dg-do compile } */
> >+/* { dg-options "-O1 -march=cascadelake" } */
> >+
> >+#include "../../gcc.c-torture/compile/20051216-1.c"
> >
> >
> >     Jakub

        Jakub

Reply via email to