On February 13, 2021 9:58:58 AM GMT+01:00, Jakub Jelinek <ja...@redhat.com> 
wrote:
>Hi!
>
>As mentioned in the PR, we have 5 split passes (+ splitting during
>final).
>split1 is before RA and is unconditional,
>split2 is after RA and is gated on optimize > 0,
>split3 is before sched2 and is gated on
>defined(INSN_SCHEDULING) && optimize > 0 &&
>flag_schedule_insns_after_reload
>split4 is before regstack and is gated on
>  HAVE_ATTR_length && defined (STACK_REGS) && !gate (split3)
>split5 is before shorten_branches and is gated on
>  HAVE_ATTR_length && !defined (STACK_REGS)
>and the splitting during final works only when !HAVE_ATTR_length.
>STACK_REGS is a macro enabled only on i386/x86_64.
>
>The problem with the following testcase is that split3 before sched2
>is the last splitting pass for the target/command line options set,
>but selective scheduling unlike normal scheduling can create new
>instructions that need to be split, which means we ICE during final as
>there are insns that require splitting but nothing split them.
>
>This patch fixes it by doing split4 also when -fselective-scheduling2
>is enabled on x86 and split3 has been run.  As that option isn't on
>by default, it should slow down compilation only for those that enable
>that option.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

Ok. But if required splitting is an IL property maybe we can see sth like 
RTL_split_insns, clear it from passes like selsched and gate split on the 
property and not being present?

Thanks, 
Richard. 

>2021-02-13  Jakub Jelinek  <ja...@redhat.com>
>
>       PR rtl-optimization/98439
>       * recog.c (pass_split_before_regstack::gate): Enable even when
>       pass_split_before_sched2 is enabled if -fselective-scheduling2 is
>       on.
>
>       * gcc.target/i386/pr98439.c: New test.
>
>--- gcc/recog.c.jj     2021-01-05 13:53:53.306683657 +0100
>+++ gcc/recog.c        2021-02-12 16:42:20.202883267 +0100
>@@ -4532,8 +4532,13 @@ pass_split_before_regstack::gate (functi
>   /* If flow2 creates new instructions which need splitting
>      and scheduling after reload is not done, they might not be
>      split until final which doesn't allow splitting
>-     if HAVE_ATTR_length.  */
>+     if HAVE_ATTR_length.  Selective scheduling can result in
>+     further instructions that need splitting.  */
>+#ifdef INSN_SCHEDULING
>+  return !enable_split_before_sched2 () || flag_selective_scheduling2;
>+#else
>   return !enable_split_before_sched2 ();
>+#endif
> #else
>   return false;
> #endif
>--- gcc/testsuite/gcc.target/i386/pr98439.c.jj 2021-02-12
>16:46:34.326012956 +0100
>+++ gcc/testsuite/gcc.target/i386/pr98439.c    2021-02-12
>16:46:19.925175619 +0100
>@@ -0,0 +1,12 @@
>+/* PR rtl-optimization/98439 */
>+/* { dg-do compile } */
>+/* { dg-options "-march=nehalem -O2 -fselective-scheduling2
>-fno-cprop-registers" } */
>+
>+int v;
>+int bar (int, int, int, int, int, int, int);
>+
>+int
>+foo (void)
>+{
>+  return bar (0, 0, 0, 0, 0, 0, v > 0 ? v : 0);
>+}
>
>       Jakub

Reply via email to