[Mlir-commits] [flang] [mlir] [mlir][flang][OpenMP] Select iterators per locator and allow multi-block regions (PR #227454)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Oct 11 20:06:29 PDT 2026


================
@@ -1046,62 +1044,54 @@ bool ClauseProcessor::processAffinity(
               .getResult();
         };
 
-        llvm::SmallVector<IteratorRange> iteratorRanges;
-        llvm::SmallPtrSet<const Fortran::semantics::Symbol *, 4> ivSyms;
-
-        auto &iteratorModifier =
-            std::get<std::optional<omp::clause::Iterator>>(clause.t);
-        collectIteratorIVs(clause, converter, stmtCtx, iteratorRanges, ivSyms);
+        auto iteratorRanges = lowerIteratorRanges(clause, converter, stmtCtx);
 
         TodoLocators(clauseLocation, objects);
-
         for (const omp::Object &object : objects) {
+          if (!object.ref())
+            continue;
+          if (evaluate::HasVectorSubscript(*object.ref()))
+            TODO(clauseLocation, "vector subscript in AFFINITY clause");
+          if (auto dataRef = evaluate::ExtractDataRef(*object.ref()))
----------------
MattPD wrote:

`ExtractDataRef` skips complex-part and substring designators by default. This iterator locator therefore reaches the bounds helper and aborts with `Unsupported type of OpenACC operand`:

```fortran
subroutine s(z)
  complex :: z(8)
  !$omp task affinity(iterator(i=1:2): z(i)%re)
  !$omp end task
end
```

At the reviewed commit, `flang -c -O1 -fopenmp -fopenmp-version=52 repro.f90` exits 254. At the [parent commit](https://github.com/llvm/llvm-project/commit/5655cabbd7b780c9b3bcfbbb07a619139990f06c), the same command exits 1 with the unsupported-iterator diagnostic. The substring locator `a(i:i)%field(1:4)` fails the same way when `field` is a scalar character component. Could the iterator AFFINITY path stop with a not-yet-implemented diagnostic for both designator kinds before generating addresses or bounds?

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


More information about the Mlir-commits mailing list