[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    [PATCH 4/6] OpenMP: Tweak NOP handling in in omp_get_root_term and accumulate_sibling_list
From:       Julian Brown <julian () codesourcery ! com>
Date:       2022-06-01 18:39:22
Message-ID: fb9af34bdb5a621cbc2ce200adeede49746cc513.1654107784.git.julian () codesourcery ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic