[4/6] OpenMP: Tweak NOP handling in in omp_get_root_term and accumulate_sibling_list
Commit Message
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(-)
@@ -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);