public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] omp-oacc-kernels-decompose.cc: fix -fcompare-debug with GIMPLE_DEBUG
Date: Fri, 21 Oct 2022 13:34:31 +0000 (GMT)	[thread overview]
Message-ID: <20221021133431.E1EBD3853546@sourceware.org> (raw)

https://gcc.gnu.org/g:20477bb3ce743660a0be2c41ad56094fe1f802e0

commit 20477bb3ce743660a0be2c41ad56094fe1f802e0
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Fri Oct 21 15:31:25 2022 +0200

    omp-oacc-kernels-decompose.cc: fix -fcompare-debug with GIMPLE_DEBUG
    
    GIMPLE_DEBUG were put in a parallel region of its own, which is not
    only pointless but also breaks -fcompare-debug. With this commit,
    they are handled like simple assignments: those placed are places
    into the same body as the loop such that only one parallel region
    remains as without debugging. This fixes the existing testcase
    libgomp.oacc-c-c++-common/kernels-loop-g.c.
    
    Note: GIMPLE_DEBUG are only accepted with -fcompare-debug; if they
    appear otherwise, decompose_kernels_region_body rejects them with
    a sorry (unchanged).
    
    gcc/
            * omp-oacc-kernels-decompose.cc (top_level_omp_for_in_stmt,
            decompose_kernels_region_body): Handle GIMPLE_DEBUG like
            simple assignment.

Diff:
---
 gcc/ChangeLog.omp                 | 6 ++++++
 gcc/omp-oacc-kernels-decompose.cc | 5 +++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 32a8c7b485f..e032c05148b 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,9 @@
+2022-10-21  Tobias Burnus  <tobias@codesourcery.com>
+
+	* omp-oacc-kernels-decompose.cc (top_level_omp_for_in_stmt,
+	decompose_kernels_region_body): Handle GIMPLE_DEBUG like
+	simple assignment.
+
 2022-10-19  Tobias Burnus  <tobias@codesourcery.com>
 
 	* omp-expand.cc (expand_omp_target): Fix OpenACC in case there
diff --git a/gcc/omp-oacc-kernels-decompose.cc b/gcc/omp-oacc-kernels-decompose.cc
index 4e940c1ee0f..a7e3d764d52 100644
--- a/gcc/omp-oacc-kernels-decompose.cc
+++ b/gcc/omp-oacc-kernels-decompose.cc
@@ -120,7 +120,8 @@ top_level_omp_for_in_stmt (gimple *stmt)
 	  for (gsi = gsi_start (body); !gsi_end_p (gsi); gsi_next (&gsi))
 	    {
 	      gimple *body_stmt = gsi_stmt (gsi);
-	      if (gimple_code (body_stmt) == GIMPLE_ASSIGN)
+	      if (gimple_code (body_stmt) == GIMPLE_ASSIGN
+		  || gimple_code (body_stmt) == GIMPLE_DEBUG)
 		continue;
 	      else if (gimple_code (body_stmt) == GIMPLE_OMP_FOR
 		       && gsi_one_before_end_p (gsi))
@@ -1398,7 +1399,7 @@ decompose_kernels_region_body (gimple *kernels_region, tree kernels_clauses)
 	    = (gimple_code (stmt) == GIMPLE_ASSIGN
 	       && TREE_CODE (gimple_assign_lhs (stmt)) == VAR_DECL
 	       && DECL_ARTIFICIAL (gimple_assign_lhs (stmt)));
-	  if (!is_simple_assignment)
+	  if (!is_simple_assignment && gimple_code (stmt) != GIMPLE_DEBUG)
 	    only_simple_assignments = false;
 	}
     }

                 reply	other threads:[~2022-10-21 13:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221021133431.E1EBD3853546@sourceware.org \
    --to=burnus@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).