public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Julian Brown <julian@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <fortran@gcc.gnu.org>, Tobias Burnus <tobias@codesourcery.com>,
	Jakub Jelinek <jakub@redhat.com>
Subject: [PATCH 4/6] OpenMP: Tweak NOP handling in in omp_get_root_term and accumulate_sibling_list
Date: Wed, 1 Jun 2022 11:39:22 -0700	[thread overview]
Message-ID: <fb9af34bdb5a621cbc2ce200adeede49746cc513.1654107784.git.julian@codesourcery.com> (raw)
In-Reply-To: <cover.1654107784.git.julian@codesourcery.com>

This patch strips NOPs in omp_get_root_term and accumulate_sibling_list
to cover cases that came up writing tests for "omp declare mapper"
functionality. I'll fold this into the originating patch series for
those functions during rework.

2022-06-01  Julian Brown  <julian@codesourcery.com>

gcc/
	* gimplify.cc (omp_get_root_term): Look through NOP_EXPRs.
	(accumulate_sibling_list): Strip NOPs on struct base pointers.
---
 gcc/gimplify.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 1646fdaa9b8..742fd5e4a8d 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -8775,7 +8775,8 @@ omp_get_root_term (tree expr)
 	 || (TREE_CODE (expr) == MEM_REF
 	     && integer_zerop (TREE_OPERAND (expr, 1)))
 	 || TREE_CODE (expr) == POINTER_PLUS_EXPR
-	 || TREE_CODE (expr) == COMPOUND_EXPR)
+	 || TREE_CODE (expr) == COMPOUND_EXPR
+	 || TREE_CODE (expr) == NOP_EXPR)
       if (TREE_CODE (expr) == COMPOUND_EXPR)
 	expr = TREE_OPERAND (expr, 1);
       else
@@ -9932,6 +9933,8 @@ accumulate_sibling_list (enum omp_region_type region_type, enum tree_code code,
 	    sdecl = TREE_OPERAND (sdecl, 0);
 	}
 
+      STRIP_NOPS (sdecl);
+
       while (TREE_CODE (sdecl) == POINTER_PLUS_EXPR)
 	sdecl = TREE_OPERAND (sdecl, 0);
 
-- 
2.29.2


  parent reply	other threads:[~2022-06-01 18:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 18:39 [PATCH 0/6] OpenMP 5.0: Fortran "declare mapper" support Julian Brown
2022-06-01 18:39 ` [PATCH 1/6] Fortran: Typo/unicode-o fixes Julian Brown
2022-12-23 10:53   ` Julian Brown
2022-06-01 18:39 ` [PATCH 2/6] OpenMP: Templatize omp_mapper_list Julian Brown
2022-06-01 18:39 ` [PATCH 3/6] OpenMP: Rename strip_components_and_deref to omp_get_root_term Julian Brown
2022-06-01 18:39 ` Julian Brown [this message]
2022-06-01 18:40 ` [PATCH 5/6] OpenMP: Pointers and member mappings Julian Brown
2022-06-01 18:40 ` [PATCH 6/6] OpenMP: Fortran "!$omp declare mapper" support Julian Brown

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=fb9af34bdb5a621cbc2ce200adeede49746cc513.1654107784.git.julian@codesourcery.com \
    --to=julian@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=tobias@codesourcery.com \
    /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).