[gcc/devel/omp/gcc-14] OpenMP: Fix GIMPLE_OMP_METADIRECTIVE in nested functions at -O0

Paul-Antoine Arras parras@gcc.gnu.org
Fri Jun 28 09:56:52 GMT 2024


https://gcc.gnu.org/g:1904112175e0822aba55d2dc0892c7b932e6e430

commit 1904112175e0822aba55d2dc0892c7b932e6e430
Author: Sandra Loosemore <sloosemore@baylibre.com>
Date:   Fri May 10 02:39:03 2024 +0000

    OpenMP: Fix GIMPLE_OMP_METADIRECTIVE in nested functions at -O0
    
    gcc/ChangeLog
            * tree-nested.cc (convert_nonlocal_reference_stmt): Handle
            GIMPLE_OMP_METADIRECTIVE specially.
            (convert_local_reference_stmt): Likewise.
            (convert_tramp_reference_stmt): Likewise.
            (convert_gimple_call): Likewise.

Diff:
---
 gcc/ChangeLog.omp  |  9 +++++++++
 gcc/tree-nested.cc | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 2ad1324cba1..16e07e7ad95 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,12 @@
+2024-05-10  Sandra Loosemore  <sloosemore@baylibre.com>
+
+	* tree-nested.cc (convert_nonlocal_reference_stmt): Handle
+	GIMPLE_OMP_METADIRECTIVE specially.
+	(convert_local_reference_stmt): Likewise.
+	(convert_tramp_reference_stmt): Likewise.
+	(convert_gimple_call): Likewise.
+
+
 2024-04-22  Sandra Loosemore  <sloosemore@baylibre.com>
 
 	* tree-nested.cc (convert_tramp_reference_stmt): Use the correct
diff --git a/gcc/tree-nested.cc b/gcc/tree-nested.cc
index 753163189a3..e466b6f63d2 100644
--- a/gcc/tree-nested.cc
+++ b/gcc/tree-nested.cc
@@ -1832,6 +1832,17 @@ convert_nonlocal_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 	         info, gimple_omp_body_ptr (stmt));
       break;
 
+    case GIMPLE_OMP_METADIRECTIVE:
+      {
+	gimple_seq variant_seq = gimple_omp_variants (stmt);
+	for (gimple_stmt_iterator gsi = gsi_start (variant_seq);
+	     !gsi_end_p (gsi); gsi_next (&gsi))
+	  walk_body (convert_nonlocal_reference_stmt,
+		     convert_nonlocal_reference_op,
+		     info, gimple_omp_body_ptr (gsi_stmt (gsi)));
+      }
+      break;
+
     case GIMPLE_BIND:
       {
       gbind *bind_stmt = as_a <gbind *> (stmt);
@@ -2567,6 +2578,17 @@ convert_local_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
 		 info, gimple_omp_body_ptr (stmt));
       break;
 
+    case GIMPLE_OMP_METADIRECTIVE:
+      {
+	gimple_seq variant_seq = gimple_omp_variants (stmt);
+	for (gimple_stmt_iterator gsi = gsi_start (variant_seq);
+	     !gsi_end_p (gsi); gsi_next (&gsi))
+	  walk_body (convert_local_reference_stmt,
+		     convert_local_reference_op,
+		     info, gimple_omp_body_ptr (gsi_stmt (gsi)));
+      }
+      break;
+
     case GIMPLE_COND:
       wi->val_only = true;
       wi->is_lhs = false;
@@ -2944,6 +2966,17 @@ convert_tramp_reference_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       }
       break;
 
+    case GIMPLE_OMP_METADIRECTIVE:
+      {
+	gimple_seq variant_seq = gimple_omp_variants (stmt);
+	for (gimple_stmt_iterator gsi = gsi_start (variant_seq);
+	     !gsi_end_p (gsi); gsi_next (&gsi))
+	  walk_body (convert_tramp_reference_stmt,
+		     convert_tramp_reference_op,
+		     info, gimple_omp_body_ptr (gsi_stmt (gsi)));
+      }
+      break;
+
     default:
       *handled_ops_p = false;
       return NULL_TREE;
@@ -3093,6 +3126,16 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       walk_body (convert_gimple_call, NULL, info, gimple_omp_body_ptr (stmt));
       break;
 
+    case GIMPLE_OMP_METADIRECTIVE:
+      {
+	gimple_seq variant_seq = gimple_omp_variants (stmt);
+	for (gimple_stmt_iterator gsi = gsi_start (variant_seq);
+	     !gsi_end_p (gsi); gsi_next (&gsi))
+	  walk_body (convert_gimple_call, NULL,
+		     info, gimple_omp_body_ptr (gsi_stmt (gsi)));
+      }
+      break;
+
     default:
       /* Keep looking for other operands.  */
       *handled_ops_p = false;


More information about the Gcc-cvs mailing list