[flang-commits] [flang] [flang][OpenMP] Revert array element reduction lowering (PR #215617)

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Wed Aug 12 07:21:41 PDT 2026


================
@@ -155,6 +155,33 @@ makeObjects(llvm::ArrayRef<const semantics::Symbol *> syms) {
   return objects;
 }
 
+static bool hasPrivatizedArrayElementReduction(
+    llvm::ArrayRef<Object> reductionObjects,
+    const llvm::SetVector<const semantics::Symbol *> &privatizedSymbols) {
+  for (const Object &object : reductionObjects) {
+    if (!object.sym() || !object.ref())
+      continue;
+    std::optional<evaluate::DataRef> dataRef =
+        evaluate::ExtractDataRef(*object.ref());
+    if (!dataRef)
+      continue;
+    const auto *arrayRef = std::get_if<evaluate::ArrayRef>(&dataRef->u);
+    if (!arrayRef ||
+        llvm::any_of(arrayRef->subscript(), [](const auto &subscript) {
+          return std::holds_alternative<evaluate::Triplet>(subscript.u);
+        }))
+      continue;
----------------
tblah wrote:

Thanks for pointing this out. Basically it was a shortcut to make the implementation simpler (particularly as we are requesting a backport to a late release candidate).

This bug was pre-existing so I will fix it in a follow-up patch only on main.

https://github.com/llvm/llvm-project/pull/215617


More information about the flang-commits mailing list