[llvm] [Frontend][OpenMP] Reduction modifier must be applied somewhere (PR #92160)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Tue May 14 11:37:57 PDT 2024


https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/92160

Detect the case when a reduction modifier ends up not being applied after construct decomposition, treat it as an error.

This fixes a regression in the gfortran test suite after PR90098.

>From b63bfe59f2c062e851b40f87089a58d012533c09 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Tue, 14 May 2024 13:23:55 -0500
Subject: [PATCH] [Frontend][OpenMP] Reduction modifier must be applied
 somewhere

Detect the case when a reduction modifier ends up not being applied after
construct decomposition, treat it as an error.

This fixes a regression in the gfortran test suite after PR90098.
---
 llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index 5f12c62b832fc..e5fcc493ea590 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -930,7 +930,8 @@ bool ConstructDecompositionT<C, H>::applyClause(
       // Apply clause without modifier.
       leaf.clauses.push_back(unmodified);
     }
-    applied = true;
+    // The modifier must be applied to some construct.
+    applied = effectiveApplied;
   }
 
   if (!applied)



More information about the llvm-commits mailing list