This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gomp4] Avoiding predication for certain blocks


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
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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]