[all-commits] [llvm/llvm-project] effdbe: [mlir][flang][OpenMP] Select depend and affinity i...
Chi-Chun, Chen via All-commits
all-commits at lists.llvm.org
Wed Sep 30 11:29:58 PDT 2026
Branch: refs/heads/users/cchen/flang_openmp_per_locator_iterator
Home: https://github.com/llvm/llvm-project
Commit: effdbec5c5f2467d10326e7ca7e0cd728c8fed40
https://github.com/llvm/llvm-project/commit/effdbec5c5f2467d10326e7ca7e0cd728c8fed40
Author: Chi-Chun, Chen <chichun.chen at hpe.com>
Date: 2026-09-30 (Wed, 30 Sep 2026)
Changed paths:
M flang/include/flang/Lower/OpenMP/Clauses.h
M flang/lib/Lower/OpenMP/ClauseProcessor.cpp
M flang/lib/Lower/OpenMP/Clauses.cpp
M flang/lib/Lower/OpenMP/Utils.cpp
M flang/lib/Lower/OpenMP/Utils.h
M flang/test/Lower/OpenMP/depend-iterator.f90
A flang/test/Lower/OpenMP/iterator-empty-range.f90
A flang/test/Lower/OpenMP/iterator-source-occurrences.f90
M flang/test/Lower/OpenMP/task-affinity.f90
M mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp
M mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp
M mlir/test/Dialect/OpenMP/invalid.mlir
A mlir/test/Dialect/OpenMP/iterator-empty.mlir
A mlir/test/Target/LLVMIR/openmp-iterator-empty.mlir
M mlir/test/Target/LLVMIR/openmp-iterator.mlir
Log Message:
-----------
[mlir][flang][OpenMP] Select depend and affinity iterators per locator
Flang expands each iterator-dependent depend or affinity locator over all
ranges in the clause, including iterators absent from that locator. For
example:
depend(iterator(i=1:2, j=3:m), in: a(i))
When m < 3, the unused empty j range suppresses both required dependences
on a. This can lose task ordering. A nonempty unused range instead repeats
entries unnecessarily; affinity locators have the same expansion problem.
Select ranges according to the iterator identifiers appearing in each
locator's source, preserving declaration order. Making this change safely
also requires preserving source occurrences and handling empty ranges:
- Record resolved iterator references before using the folded expression
for lowering. In a(j/d + 0*i), folding removes 0*i, but an empty i range
must still suppress the locator and prevent evaluation of j/d.
- Keep references per locator and separate from object identity, since
distinct source locators can have equal folded designators.
- Fix zero-trip counting: removing an unused range can expose a negative
count previously masked by multiplication by zero. Use the canonical
count helper with i65 intermediates to avoid signed span overflow.
- Accept constant empty ranges in the verifier, retaining the zero-step
diagnostic so constant and dynamic empty ranges behave consistently.
- Test depend and affinity counts, locator evaluation guards, folded
references, shadowed names, and target-clause propagation.
Addresses the prerequisite fix requested for #197757:
https://github.com/llvm/llvm-project/pull/197757#discussion_r4079319531
Fixes https://github.com/llvm/llvm-project/issues/227443.
Assisted with codex.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list