public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4] Avoiding predication for certain blocks
@ 2015-05-29 17:12 Bernd Schmidt
  2015-06-01 10:10 ` Tom de Vries
  2016-04-08  6:32 ` Thomas Schwinge
  0 siblings, 2 replies; 6+ messages in thread
From: Bernd Schmidt @ 2015-05-29 17:12 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 414 bytes --]

When predicating the code for OpenACC, we should avoid the entry block 
in an offloaded region, which contains setup code that should be run in 
every thread. The following patch adds a new marker statement that is 
used to identify this block. Currently, predication doesn't happen 
anyway due to an oversight in the algorithm, but I'll be fixing that in 
a followup patch.

Committed on gomp-4_0-branch.


Bernd

[-- Attachment #2: omp-entry.diff --]
[-- Type: text/x-patch, Size: 5707 bytes --]

Index: gcc/ChangeLog.gomp
===================================================================
--- gcc/ChangeLog.gomp	(revision 223867)
+++ gcc/ChangeLog.gomp	(working copy)
@@ -1,3 +1,18 @@
+2015-05-29  Bernd Schmidt  <bernds@codesourcery.com>
+
+	* gimple.def (GIMPLE_OMP_ENTRY_END): New code.
+	* gimple.h (gimple_build_omp_entry_end): Declare.
+	(CASE_GIMPLE_OMP): Add GIMPLE_OMP_ENTRY_END.
+	* gimple.c (gimple_build_omp_entry_end): New function.
+	* gimple-low.c (lower_stmt): Handle GIMPLE_OMP_ENTRY_END.
+	* omp-low.c (expand_omp_target): Remove the entry end statement.
+	(predicate_bb): Don't predicate a block ending with
+	GIMPLE_OMP_ENTRY_END.
+	(lower_omp_target): Append a GIMPLE_OMP_ENTRY_END after the
+	ganglocal data allocation.
+	(make_gimple_omp_edges): Handle GIMPLE_OMP_ENTRY_END.
+	* gimple-pretty-print.c (pp_gimple_stmt_1): Likewise.
+
 2015-05-28  Tom de Vries  <tom@codesourcery.com>
 
 	* passes.def: Replace pass_copy_prop with pass_fre. Surround with
Index: gcc/gimple-low.c
===================================================================
--- gcc/gimple-low.c	(revision 223867)
+++ gcc/gimple-low.c	(working copy)
@@ -337,6 +337,7 @@ lower_stmt (gimple_stmt_iterator *gsi, s
     case GIMPLE_OMP_ATOMIC_LOAD:
     case GIMPLE_OMP_ATOMIC_STORE:
     case GIMPLE_OMP_CONTINUE:
+    case GIMPLE_OMP_ENTRY_END:
       break;
 
     case GIMPLE_CALL:
Index: gcc/gimple-pretty-print.c
===================================================================
--- gcc/gimple-pretty-print.c	(revision 223867)
+++ gcc/gimple-pretty-print.c	(working copy)
@@ -2253,6 +2253,10 @@ pp_gimple_stmt_1 (pretty_printer *buffer
       pp_string (buffer, "GIMPLE_SECTIONS_SWITCH");
       break;
 
+    case GIMPLE_OMP_ENTRY_END:
+      pp_string (buffer, "GIMPLE_OMP_ENTRY_END");
+      break;
+
     case GIMPLE_OMP_MASTER:
     case GIMPLE_OMP_TASKGROUP:
     case GIMPLE_OMP_ORDERED:
Index: gcc/gimple.c
===================================================================
--- gcc/gimple.c	(revision 223867)
+++ gcc/gimple.c	(working copy)
@@ -852,6 +852,15 @@ gimple_build_debug_source_bind_stat (tre
 }
 
 
+/* Build a GIMPLE_OMP_ENTRY_END statement.  */
+
+gimple
+gimple_build_omp_entry_end (void)
+{
+  return gimple_alloc (GIMPLE_OMP_ENTRY_END, 0);
+}
+
+
 /* Build a GIMPLE_OMP_CRITICAL statement.
 
    BODY is the sequence of statements for which only one thread can execute.
Index: gcc/gimple.def
===================================================================
--- gcc/gimple.def	(revision 223867)
+++ gcc/gimple.def	(working copy)
@@ -227,6 +227,10 @@ DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, "gimp
    iteration in partially lowered OpenMP code.  */
 DEFGSCODE(GIMPLE_OMP_CONTINUE, "gimple_omp_continue", GSS_OMP_CONTINUE)
 
+/* GIMPLE_OMP_ENTRY_END marks the end of the unpredicated entry block
+   into an offloaded region.  */
+DEFGSCODE(GIMPLE_OMP_ENTRY_END, "gimple_omp_entry_end", GSS_BASE)
+
 /* GIMPLE_OMP_CRITICAL <NAME, BODY> represents
 
    #pragma omp critical [name]
Index: gcc/gimple.h
===================================================================
--- gcc/gimple.h	(revision 223867)
+++ gcc/gimple.h	(working copy)
@@ -1351,6 +1351,7 @@ gimple gimple_build_omp_taskgroup (gimpl
 gomp_continue *gimple_build_omp_continue (tree, tree);
 gimple gimple_build_omp_ordered (gimple_seq);
 gimple gimple_build_omp_return (bool);
+gimple gimple_build_omp_entry_end ();
 gomp_sections *gimple_build_omp_sections (gimple_seq, tree);
 gimple gimple_build_omp_sections_switch (void);
 gomp_single *gimple_build_omp_single (gimple_seq, tree);
@@ -5597,6 +5598,7 @@ gimple_return_set_retbnd (gimple gs, tre
     case GIMPLE_OMP_ORDERED:			\
     case GIMPLE_OMP_CRITICAL:			\
     case GIMPLE_OMP_RETURN:			\
+    case GIMPLE_OMP_ENTRY_END:			\
     case GIMPLE_OMP_ATOMIC_LOAD:		\
     case GIMPLE_OMP_ATOMIC_STORE:		\
     case GIMPLE_OMP_CONTINUE
Index: gcc/omp-low.c
===================================================================
--- gcc/omp-low.c	(revision 223867)
+++ gcc/omp-low.c	(working copy)
@@ -9480,6 +9480,11 @@ expand_omp_target (struct omp_region *re
 	}
     }
 
+  basic_block entry_succ_bb = single_succ (entry_bb);
+  gsi = gsi_last_bb (entry_succ_bb);
+  if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END)
+    gsi_remove (&gsi, true);
+
   if (offloaded
       && do_splitoff)
     {
@@ -9501,7 +9506,6 @@ expand_omp_target (struct omp_region *re
       tree data_arg = gimple_omp_target_data_arg (entry_stmt);
       if (data_arg)
 	{
-	  basic_block entry_succ_bb = single_succ (entry_bb);
 	  gimple_stmt_iterator gsi;
 	  tree arg, narg;
 	  gimple tgtcopy_stmt = NULL;
@@ -10131,6 +10135,8 @@ build_omp_regions_1 (basic_block bb, str
 	  gcc_assert (parent);
 	  parent->cont = bb;
 	}
+      else if (code == GIMPLE_OMP_ENTRY_END)
+	gcc_assert (parent);
       else if (code == GIMPLE_OMP_SECTIONS_SWITCH)
 	{
 	  /* GIMPLE_OMP_SECTIONS_SWITCH is part of
@@ -10308,6 +10314,9 @@ predicate_bb (basic_block bb, struct omp
   basic_block skip_dest_bb = NULL;
   basic_block *adjust_bb_ptr = NULL;
 
+  if (gimple_code (stmt) == GIMPLE_OMP_ENTRY_END)
+    return;
+
   if (gimple_code (stmt) == GIMPLE_COND)
     {
       tree cond_var = create_tmp_var (boolean_type_node);
@@ -12705,6 +12714,7 @@ lower_omp_target (gimple_stmt_iterator *
 
   if (offloaded)
     {
+      gimple_seq_add_stmt (&new_body, gimple_build_omp_entry_end ());
       if (has_reduction)
 	{
 	  gimple_seq_add_seq (&irlist, tgt_body);
@@ -13442,6 +13452,7 @@ make_gimple_omp_edges (basic_block bb, s
       fallthru = false;
       break;
 
+    case GIMPLE_OMP_ENTRY_END:
     case GIMPLE_OMP_ATOMIC_LOAD:
     case GIMPLE_OMP_ATOMIC_STORE:
        fallthru = true;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gomp4] Avoiding predication for certain blocks
  2015-05-29 17:12 [gomp4] Avoiding predication for certain blocks Bernd Schmidt
@ 2015-06-01 10:10 ` Tom de Vries
  2015-06-01 11:58   ` Thomas Schwinge
  2015-06-01 12:08   ` Bernd Schmidt
  2016-04-08  6:32 ` Thomas Schwinge
  1 sibling, 2 replies; 6+ messages in thread
From: Tom de Vries @ 2015-06-01 10:10 UTC (permalink / raw)
  To: Bernd Schmidt, gcc-patches; +Cc: Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]

On 29/05/15 18:23, Bernd Schmidt wrote:
> When predicating the code for OpenACC, we should avoid the entry block
> in an offloaded region, which contains setup code that should be run in
> every thread. The following patch adds a new marker statement that is
> used to identify this block. Currently, predication doesn't happen
> anyway due to an oversight in the algorithm, but I'll be fixing that in
> a followup patch.
>
> Committed on gomp-4_0-branch.
>

Hi Bernd,

this causes an ICE in kernels-eternal.c.

The GIMPLE_OMP_ENTRY_END is removed the first time (!ssa) we call 
expand_omp_target. The second time we call expand_omp_target (ssa), it's 
no longer there, and we call 'gimple_code (NULL)' here:
...
   basic_block entry_succ_bb = single_succ (entry_bb);
   gsi = gsi_last_bb (entry_succ_bb);
   if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END)
     gsi_remove (&gsi, true);
...

This patch fixes that by not attempting to remove GIMPLE_OMP_ENTRY_END 
when in ssa.

Committed to gomp-4_0-branch.

Thanks,
- Tom

[-- Attachment #2: 0001-Fix-GIMPLE_OMP_ENTRY_END-handling-in-expand_omp_targ.patch --]
[-- Type: text/x-patch, Size: 885 bytes --]

Fix GIMPLE_OMP_ENTRY_END handling in expand_omp_target for ssa

2015-06-01  Tom de Vries  <tom@codesourcery.com>

	* omp-low.c (expand_omp_target): Fix GIMPLE_OMP_ENTRY_END handling for
	ssa.

---
 gcc/omp-low.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index a74a2bea..2634051 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -9486,9 +9486,12 @@ expand_omp_target (struct omp_region *region)
     }
 
   basic_block entry_succ_bb = single_succ (entry_bb);
-  gsi = gsi_last_bb (entry_succ_bb);
-  if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END)
-    gsi_remove (&gsi, true);
+  if (!gimple_in_ssa_p (cfun))
+    {
+      gsi = gsi_last_bb (entry_succ_bb);
+      if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END)
+	gsi_remove (&gsi, true);
+    }
 
   if (offloaded
       && do_splitoff)
-- 
1.9.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gomp4] Avoiding predication for certain blocks
  2015-06-01 10:10 ` Tom de Vries
@ 2015-06-01 11:58   ` Thomas Schwinge
  2015-06-03 11:43     ` Thomas Schwinge
  2015-06-01 12:08   ` Bernd Schmidt
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Schwinge @ 2015-06-01 11:58 UTC (permalink / raw)
  To: Tom de Vries, Bernd Schmidt; +Cc: Jakub Jelinek, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 3542 bytes --]

Hi!

On Mon, 1 Jun 2015 12:10:12 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
> On 29/05/15 18:23, Bernd Schmidt wrote:
> > When predicating the code for OpenACC, we should avoid the entry block
> > in an offloaded region, which contains setup code that should be run in
> > every thread. The following patch adds a new marker statement that is
> > used to identify this block. Currently, predication doesn't happen
> > anyway due to an oversight in the algorithm, but I'll be fixing that in
> > a followup patch.
> >
> > Committed on gomp-4_0-branch.

> this causes an ICE in kernels-eternal.c.

(Belatedly) confirmed:

    [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c (internal compiler error)+}
    {+FAIL:+} c-c++-common/goacc/kernels-eternal.c (test for excess errors)

    [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c  -std=c++11 (internal compiler error)+}
    {+FAIL:+} c-c++-common/goacc/kernels-eternal.c  -std=c++11 (test for excess errors)
    [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c  -std=c++14 (internal compiler error)+}
    {+FAIL:+} c-c++-common/goacc/kernels-eternal.c  -std=c++14 (test for excess errors)
    [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c  -std=c++98 (internal compiler error)+}
    {+FAIL:+} c-c++-common/goacc/kernels-eternal.c  -std=c++98 (test for excess errors)

> The GIMPLE_OMP_ENTRY_END is removed the first time (!ssa) we call 
> expand_omp_target. The second time we call expand_omp_target (ssa), it's 
> no longer there, and we call 'gimple_code (NULL)' here:
> ...
>    basic_block entry_succ_bb = single_succ (entry_bb);
>    gsi = gsi_last_bb (entry_succ_bb);
>    if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END)
>      gsi_remove (&gsi, true);
> ...
> 
> This patch fixes that by not attempting to remove GIMPLE_OMP_ENTRY_END 
> when in ssa.
> 
> Committed to gomp-4_0-branch.

I also observed -- and still do observe -- ICEs as follows.  Tom, as
you've fixed (thanks!) this already for
c-c++-common/goacc/kernels-eternal.c, would you mind fixing it for these,
too:

    [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c (internal compiler error)+}
    {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c (test for excess errors)

    [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c (internal compiler error)+}
    {+FAIL:+} c-c++-common/gomp/nesting-1.c (test for excess errors)

    [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c  -std=c++11 (internal compiler error)+}
    {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c  -std=c++11 (test for excess errors)
    [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c  -std=c++14 (internal compiler error)+}
    {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c  -std=c++14 (test for excess errors)
    [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c  -std=c++98 (internal compiler error)+}
    {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c  -std=c++98 (test for excess errors)

    [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c  -std=c++11 (internal compiler error)+}
    {+FAIL:+} c-c++-common/gomp/nesting-1.c  -std=c++11 (test for excess errors)
    [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c  -std=c++14 (internal compiler error)+}
    {+FAIL:+} c-c++-common/gomp/nesting-1.c  -std=c++14 (test for excess errors)
    [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c  -std=c++98 (internal compiler error)+}
    {+FAIL:+} c-c++-common/gomp/nesting-1.c  -std=c++98 (test for excess errors)


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gomp4] Avoiding predication for certain blocks
  2015-06-01 10:10 ` Tom de Vries
  2015-06-01 11:58   ` Thomas Schwinge
@ 2015-06-01 12:08   ` Bernd Schmidt
  1 sibling, 0 replies; 6+ messages in thread
From: Bernd Schmidt @ 2015-06-01 12:08 UTC (permalink / raw)
  To: Tom de Vries, gcc-patches; +Cc: Jakub Jelinek

On 06/01/2015 12:10 PM, Tom de Vries wrote:
> On 29/05/15 18:23, Bernd Schmidt wrote:
>> When predicating the code for OpenACC, we should avoid the entry block
>> in an offloaded region, which contains setup code that should be run in
>> every thread. The following patch adds a new marker statement that is
>> used to identify this block. Currently, predication doesn't happen
>> anyway due to an oversight in the algorithm, but I'll be fixing that in
>> a followup patch.
>>
>> Committed on gomp-4_0-branch.
>>
>
> Hi Bernd,
>
> this causes an ICE in kernels-eternal.c.

I don't see this test on my branch checkout - is it something you are 
using locally?


Bernd

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gomp4] Avoiding predication for certain blocks
  2015-06-01 11:58   ` Thomas Schwinge
@ 2015-06-03 11:43     ` Thomas Schwinge
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Schwinge @ 2015-06-03 11:43 UTC (permalink / raw)
  To: Tom de Vries; +Cc: Jakub Jelinek, gcc-patches, Bernd Schmidt

[-- Attachment #1: Type: text/plain, Size: 3874 bytes --]

Hi!

On Mon, 01 Jun 2015 13:57:47 +0200, I wrote:
> On Mon, 1 Jun 2015 12:10:12 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
> > On 29/05/15 18:23, Bernd Schmidt wrote:
> > > When predicating the code for OpenACC, we should avoid the entry block
> > > in an offloaded region, which contains setup code that should be run in
> > > every thread. The following patch adds a new marker statement that is
> > > used to identify this block. Currently, predication doesn't happen
> > > anyway due to an oversight in the algorithm, but I'll be fixing that in
> > > a followup patch.
> > >
> > > Committed on gomp-4_0-branch.
> 
> > this causes an ICE in kernels-eternal.c.
> 
> (Belatedly) confirmed:
> 
>     [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c (internal compiler error)+}
>     {+FAIL:+} c-c++-common/goacc/kernels-eternal.c (test for excess errors)
> 
>     [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c  -std=c++11 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/goacc/kernels-eternal.c  -std=c++11 (test for excess errors)
>     [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c  -std=c++14 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/goacc/kernels-eternal.c  -std=c++14 (test for excess errors)
>     [-PASS:-]{+FAIL: c-c++-common/goacc/kernels-eternal.c  -std=c++98 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/goacc/kernels-eternal.c  -std=c++98 (test for excess errors)
> 
> > The GIMPLE_OMP_ENTRY_END is removed the first time (!ssa) we call 
> > expand_omp_target. The second time we call expand_omp_target (ssa), it's 
> > no longer there, and we call 'gimple_code (NULL)' here:
> > ...
> >    basic_block entry_succ_bb = single_succ (entry_bb);
> >    gsi = gsi_last_bb (entry_succ_bb);
> >    if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END)
> >      gsi_remove (&gsi, true);
> > ...
> > 
> > This patch fixes that by not attempting to remove GIMPLE_OMP_ENTRY_END 
> > when in ssa.
> > 
> > Committed to gomp-4_0-branch.
> 
> I also observed -- and still do observe -- ICEs as follows.  Tom, as
> you've fixed (thanks!) this already for
> c-c++-common/goacc/kernels-eternal.c, would you mind fixing it for these,
> too:
> 
>     [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c (internal compiler error)+}
>     {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c (test for excess errors)
> 
>     [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c (internal compiler error)+}
>     {+FAIL:+} c-c++-common/gomp/nesting-1.c (test for excess errors)
> 
>     [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c  -std=c++11 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c  -std=c++11 (test for excess errors)
>     [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c  -std=c++14 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c  -std=c++14 (test for excess errors)
>     [-PASS:-]{+FAIL: c-c++-common/goacc-gomp/nesting-1.c  -std=c++98 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/goacc-gomp/nesting-1.c  -std=c++98 (test for excess errors)
> 
>     [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c  -std=c++11 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/gomp/nesting-1.c  -std=c++11 (test for excess errors)
>     [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c  -std=c++14 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/gomp/nesting-1.c  -std=c++14 (test for excess errors)
>     [-PASS:-]{+FAIL: c-c++-common/gomp/nesting-1.c  -std=c++98 (internal compiler error)+}
>     {+FAIL:+} c-c++-common/gomp/nesting-1.c  -std=c++98 (test for excess errors)

Bernd fixed this as part of his gomp-4_0-branch commit r224073:
»omp-low.c [...] (expand_omp_target): Only look for entry-end statement
if offloaded«.


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gomp4] Avoiding predication for certain blocks
  2015-05-29 17:12 [gomp4] Avoiding predication for certain blocks Bernd Schmidt
  2015-06-01 10:10 ` Tom de Vries
@ 2016-04-08  6:32 ` Thomas Schwinge
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Schwinge @ 2016-04-08  6:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bernd Schmidt, Jakub Jelinek, Nathan Sidwell

[-- Attachment #1: Type: text/plain, Size: 6988 bytes --]

Hi!

I cleaned up this remnant from an earlier OpenACC execution model
implementation:

On Fri, 29 May 2015 18:23:21 +0200, Bernd Schmidt <bernds@codesourcery.com> wrote:
> When predicating the code for OpenACC, we should avoid the entry block 
> in an offloaded region, which contains setup code that should be run in 
> every thread. The following patch adds a new marker statement that is 
> used to identify this block. Currently, predication doesn't happen 
> anyway due to an oversight in the algorithm, but I'll be fixing that in 
> a followup patch.
> 
> Committed on gomp-4_0-branch.

> --- gcc/gimple.def	(revision 223867)
> +++ gcc/gimple.def	(working copy)

> +/* GIMPLE_OMP_ENTRY_END marks the end of the unpredicated entry block
> +   into an offloaded region.  */
> +DEFGSCODE(GIMPLE_OMP_ENTRY_END, "gimple_omp_entry_end", GSS_BASE)

Committed to gomp-4_0-branch in r234822:

commit af76e7c5279c0eb87b6b91b42d2568679ad6bbb9
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Apr 8 06:30:08 2016 +0000

    Remove GIMPLE_OMP_ENTRY_END
    
    	gcc/
    	* gimple.def: Remove GIMPLE_OMP_ENTRY_END.  Remove all uses.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@234822 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog.gomp        |  4 ++++
 gcc/gimple-low.c          |  1 -
 gcc/gimple-pretty-print.c |  4 ----
 gcc/gimple.c              |  9 ---------
 gcc/gimple.def            |  4 ----
 gcc/gimple.h              |  2 --
 gcc/omp-low.c             | 15 +--------------
 7 files changed, 5 insertions(+), 34 deletions(-)

diff --git gcc/ChangeLog.gomp gcc/ChangeLog.gomp
index 3c9eed6..bffc261 100644
--- gcc/ChangeLog.gomp
+++ gcc/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2016-04-08  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* gimple.def: Remove GIMPLE_OMP_ENTRY_END.  Remove all uses.
+
 2016-03-11  Cesar Philippidis  <cesar@codesourcery.com>
 
 	* config/nvptx/nvptx.c (nvptx_gen_shuffle): Add support for QImode
diff --git gcc/gimple-low.c gcc/gimple-low.c
index 13c0165..eb90d48 100644
--- gcc/gimple-low.c
+++ gcc/gimple-low.c
@@ -313,7 +313,6 @@ lower_stmt (gimple_stmt_iterator *gsi, struct lower_data *data)
     case GIMPLE_OMP_ATOMIC_LOAD:
     case GIMPLE_OMP_ATOMIC_STORE:
     case GIMPLE_OMP_CONTINUE:
-    case GIMPLE_OMP_ENTRY_END:
       break;
 
     case GIMPLE_CALL:
diff --git gcc/gimple-pretty-print.c gcc/gimple-pretty-print.c
index 50d61fa..e27214f 100644
--- gcc/gimple-pretty-print.c
+++ gcc/gimple-pretty-print.c
@@ -2304,10 +2304,6 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple *gs, int spc, int flags)
       pp_string (buffer, "GIMPLE_SECTIONS_SWITCH");
       break;
 
-    case GIMPLE_OMP_ENTRY_END:
-      pp_string (buffer, "GIMPLE_OMP_ENTRY_END");
-      break;
-
     case GIMPLE_OMP_MASTER:
     case GIMPLE_OMP_TASKGROUP:
     case GIMPLE_OMP_SECTION:
diff --git gcc/gimple.c gcc/gimple.c
index ee11112..b0e19d5 100644
--- gcc/gimple.c
+++ gcc/gimple.c
@@ -828,15 +828,6 @@ gimple_build_debug_source_bind_stat (tree var, tree value,
 }
 
 
-/* Build a GIMPLE_OMP_ENTRY_END statement.  */
-
-gimple *
-gimple_build_omp_entry_end (void)
-{
-  return gimple_alloc (GIMPLE_OMP_ENTRY_END, 0);
-}
-
-
 /* Build a GIMPLE_OMP_CRITICAL statement.
 
    BODY is the sequence of statements for which only one thread can execute.
diff --git gcc/gimple.def gcc/gimple.def
index faf0166..2ff22b8 100644
--- gcc/gimple.def
+++ gcc/gimple.def
@@ -227,10 +227,6 @@ DEFGSCODE(GIMPLE_OMP_ATOMIC_STORE, "gimple_omp_atomic_store",
    iteration in partially lowered OpenMP code.  */
 DEFGSCODE(GIMPLE_OMP_CONTINUE, "gimple_omp_continue", GSS_OMP_CONTINUE)
 
-/* GIMPLE_OMP_ENTRY_END marks the end of the unpredicated entry block
-   into an offloaded region.  */
-DEFGSCODE(GIMPLE_OMP_ENTRY_END, "gimple_omp_entry_end", GSS_BASE)
-
 /* GIMPLE_OMP_CRITICAL <NAME, BODY> represents
 
    #pragma omp critical [name]
diff --git gcc/gimple.h gcc/gimple.h
index 22d2a07..6d15dab 100644
--- gcc/gimple.h
+++ gcc/gimple.h
@@ -1451,7 +1451,6 @@ gdebug *gimple_build_debug_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
 gdebug *gimple_build_debug_source_bind_stat (tree, tree, gimple * MEM_STAT_DECL);
 #define gimple_build_debug_source_bind(var,val,stmt)			\
   gimple_build_debug_source_bind_stat ((var), (val), (stmt) MEM_STAT_INFO)
-gimple *gimple_build_omp_entry_end (void);
 gomp_critical *gimple_build_omp_critical (gimple_seq, tree, tree);
 gomp_for *gimple_build_omp_for (gimple_seq, int, tree, size_t, gimple_seq);
 gomp_parallel *gimple_build_omp_parallel (gimple_seq, tree, tree, tree);
@@ -6061,7 +6060,6 @@ gimple_return_set_retbnd (gimple *gs, tree retval)
     case GIMPLE_OMP_ORDERED:			\
     case GIMPLE_OMP_CRITICAL:			\
     case GIMPLE_OMP_RETURN:			\
-    case GIMPLE_OMP_ENTRY_END:			\
     case GIMPLE_OMP_ATOMIC_LOAD:		\
     case GIMPLE_OMP_ATOMIC_STORE:		\
     case GIMPLE_OMP_CONTINUE:			\
diff --git gcc/omp-low.c gcc/omp-low.c
index 299447e..9cb6425 100644
--- gcc/omp-low.c
+++ gcc/omp-low.c
@@ -13159,14 +13159,6 @@ expand_omp_target (struct omp_region *region)
   if (gimple_omp_target_kind (entry_stmt) == GF_OMP_TARGET_KIND_OACC_KERNELS)
     mark_loops_in_oacc_kernels_region (region->entry, region->exit);
 
-  basic_block entry_succ_bb = single_succ (entry_bb);
-  if (offloaded)
-    {
-      gsi = gsi_last_bb (entry_succ_bb);
-      if (gimple_code (gsi_stmt (gsi)) == GIMPLE_OMP_ENTRY_END)
-	gsi_remove (&gsi, true);
-    }
-
   if (offloaded)
     {
       unsigned srcidx, dstidx, num;
@@ -13187,6 +13179,7 @@ expand_omp_target (struct omp_region *region)
       tree data_arg = gimple_omp_target_data_arg (entry_stmt);
       if (data_arg)
 	{
+	  basic_block entry_succ_bb = single_succ (entry_bb);
 	  gimple_stmt_iterator gsi;
 	  tree arg;
 	  gimple *tgtcopy_stmt = NULL;
@@ -14063,8 +14056,6 @@ build_omp_regions_1 (basic_block bb, struct omp_region *parent,
 	  gcc_assert (parent);
 	  parent->cont = bb;
 	}
-      else if (code == GIMPLE_OMP_ENTRY_END)
-	gcc_assert (parent);
       else if (code == GIMPLE_OMP_SECTIONS_SWITCH)
 	{
 	  /* GIMPLE_OMP_SECTIONS_SWITCH is part of
@@ -16978,9 +16969,6 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 				 false, NULL, NULL, &fork_seq, &join_seq, ctx);
 	}
 
-      if (offloaded)
-	gimple_seq_add_stmt (&new_body, gimple_build_omp_entry_end ());
-
       gimple_seq_add_seq (&new_body, fork_seq);
       gimple_seq_add_seq (&new_body, tgt_body);
       gimple_seq_add_seq (&new_body, join_seq);
@@ -18501,7 +18489,6 @@ make_gimple_omp_edges (basic_block bb, struct omp_region **region,
       fallthru = false;
       break;
 
-    case GIMPLE_OMP_ENTRY_END:
     case GIMPLE_OMP_ATOMIC_LOAD:
     case GIMPLE_OMP_ATOMIC_STORE:
        fallthru = true;


Grüße
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-04-08  6:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-29 17:12 [gomp4] Avoiding predication for certain blocks Bernd Schmidt
2015-06-01 10:10 ` Tom de Vries
2015-06-01 11:58   ` Thomas Schwinge
2015-06-03 11:43     ` Thomas Schwinge
2015-06-01 12:08   ` Bernd Schmidt
2016-04-08  6:32 ` Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).