diff mbox

[gomp4,committed] Fix if-clause handling for kernels

Message ID 55A94B3A.4080200@mentor.com
State New
Headers show

Commit Message

Tom de Vries July 17, 2015, 6:36 p.m. UTC
Hi,

this patch fixes a problem with if-clauses on kernels, reported by Jim.

It makes sure the condition testing code is generated after the 
definition of the condition variable.

Bootstrapped on x86_64, committed to gomp-4_0-branch.

Thanks,
- Tom

Comments

Jakub Jelinek July 17, 2015, 6:47 p.m. UTC | #1
On Fri, Jul 17, 2015 at 08:36:42PM +0200, Tom de Vries wrote:
> diff --git a/gcc/omp-low.c b/gcc/omp-low.c
> index 0419dcd..9b062e6 100644
> --- a/gcc/omp-low.c
> +++ b/gcc/omp-low.c
> @@ -9643,7 +9643,8 @@ expand_omp_target (struct omp_region *region)
>        tree tmp_var;
>  
>        tmp_var = create_tmp_var (TREE_TYPE (device));
> -      if (offloaded)
> +      if (offloaded
> +	  && do_splitoff)

Such short conditions belong on a single line IMHO.

	Jakub
diff mbox

Patch

Fix if-clause handling for kernels

2015-07-17  Tom de Vries  <tom@codesourcery.com>

	* omp-low.c (expand_omp_target): Fix location of insertion of if-clause
	handling code.

	* c-c++-common/goacc/if-clause-2.c: Compile with -Wall.
---
 gcc/omp-low.c                                  | 3 ++-
 gcc/testsuite/c-c++-common/goacc/if-clause-2.c | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 0419dcd..9b062e6 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -9643,7 +9643,8 @@  expand_omp_target (struct omp_region *region)
       tree tmp_var;
 
       tmp_var = create_tmp_var (TREE_TYPE (device));
-      if (offloaded)
+      if (offloaded
+	  && do_splitoff)
 	e = split_block_after_labels (new_bb);
       else
 	{
diff --git a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
index 5ab8459..bf7d6ed 100644
--- a/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
+++ b/gcc/testsuite/c-c++-common/goacc/if-clause-2.c
@@ -1,3 +1,5 @@ 
+/* { dg-additional-options "-Wall" } */
+
 void
 f (short c)
 {
-- 
1.9.1