Patchwork PR 54472

login
register
mail settings
Submitter Andrey Belevantsev
Date Oct. 30, 2012, 8:09 a.m.
Message ID <508F8B4B.2000103@ispras.ru>
Download mbox | patch
Permalink /patch/195320/
State New
Headers show

Comments

Andrey Belevantsev - Oct. 30, 2012, 8:09 a.m.
Hello,

This PR is due to the selective scheduling missing the dependencies with 
implicit_sets.  From the sched-deps.c code it looks like implicit sets 
generate anti dependencies with either sets, uses or clobbers, so that's 
that I've done with the below patch.  Vlad, as it looks you've added 
implicit sets, does the above conclusion look correct?  I will commit the 
patch then after bootstrapping and testing will complete.

Yours,
Andrey

2012-10-30  Andrey Belevantsev  <abel@ispras.ru>

	PR rtl-optimization/54472

	* sel-sched-ir.c (has_dependence_note_reg_set): Handle
	implicit sets.
	(has_dependence_note_reg_clobber,
	has_dependence_note_reg_use): Likewise.

2012-10-30  Andrey Belevantsev  <abel@ispras.ru>

	PR rtl-optimization/54472
	
	* gcc.dg/pr54472.c: New test.
Andrey Belevantsev - Nov. 9, 2012, 12:32 p.m.
On 30.10.2012 12:09, Andrey Belevantsev wrote:
> Hello,
>
> This PR is due to the selective scheduling missing the dependencies with
> implicit_sets.  From the sched-deps.c code it looks like implicit sets
> generate anti dependencies with either sets, uses or clobbers, so that's
> that I've done with the below patch.  Vlad, as it looks you've added
> implicit sets, does the above conclusion look correct?  I will commit the
> patch then after bootstrapping and testing will complete.
>

Now committed after offline discussion with Vlad and Alexander.

Andrey

Patch

diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c
index 2a7a170..220568a 100644
--- a/gcc/sel-sched-ir.c
+++ b/gcc/sel-sched-ir.c
@@ -3185,7 +3185,7 @@  has_dependence_note_reg_set (int regno)
           || reg_last->clobbers != NULL)
         *dsp = (*dsp & ~SPECULATIVE) | DEP_OUTPUT;

-      if (reg_last->uses)
+      if (reg_last->uses || reg_last->implicit_sets)
         *dsp = (*dsp & ~SPECULATIVE) | DEP_ANTI;
      }
  }
@@ -3205,7 +3205,7 @@  has_dependence_note_reg_clobber (int regno)
        if (reg_last->sets)
         *dsp = (*dsp & ~SPECULATIVE) | DEP_OUTPUT;

-      if (reg_last->uses)
+      if (reg_last->uses || reg_last->implicit_sets)
         *dsp = (*dsp & ~SPECULATIVE) | DEP_ANTI;
      }
  }
@@ -3225,7 +3225,7 @@  has_dependence_note_reg_use (int regno)
        if (reg_last->sets)
         *dsp = (*dsp & ~SPECULATIVE) | DEP_TRUE;

-      if (reg_last->clobbers)
+      if (reg_last->clobbers || reg_last->implicit_sets)
         *dsp = (*dsp & ~SPECULATIVE) | DEP_ANTI;

        /* Merge BE_IN_SPEC bits into *DSP when the dependency producer
diff --git a/gcc/testsuite/gcc.dg/pr54472.c b/gcc/testsuite/gcc.dg/pr54472.c
new file mode 100644
index 0000000..9395203
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr54472.c
@@ -0,0 +1,9 @@ 
+/* { dg-do compile { target powerpc*-*-* ia64-*-* x86_64-*-* } } */
+/* { dg-options "-O -fschedule-insns -fselective-scheduling" } */
+
+int main ()
+{
+  int a[3][3][3];
+  __builtin_memset (a, 0, sizeof a);
+  return 0;
+}