[flang-commits] [flang] [llvm] [mlir] [flang][OpenMP] Support the FULL clause on the UNROLL construct (PR #214115)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Wed Aug 5 06:04:26 PDT 2026
================
@@ -443,6 +443,46 @@ void OmpStructureChecker::Enter(const parser::OpenMPLoopConstruct &x) {
beginName.v == llvm::omp::Directive::OMPD_distribute_simd) {
CheckDistLinear(x);
}
+ if (beginName.v == llvm::omp::Directive::OMPD_unroll) {
+ CheckUnrollFullTripCount(x);
+ }
+}
+
+// A loop that is fully unrolled must have a trip count that is known at compile
+// time, so its bounds and step have to be constant expressions.
+void OmpStructureChecker::CheckUnrollFullTripCount(
+ const parser::OpenMPLoopConstruct &x) {
+ const parser::OmpDirectiveSpecification &beginSpec{x.BeginDir()};
+ const parser::OmpClause *full{
+ parser::omp::FindClause(beginSpec, llvm::omp::Clause::OMPC_full)};
+ if (!full) {
+ return;
+ }
+
+ for (const parser::ExecutionPartConstruct &construct :
----------------
tblah wrote:
nit: I think this could be done more neatly using OpenMPLoopConstruct::GetNestedLoop
https://github.com/llvm/llvm-project/pull/214115
More information about the flang-commits
mailing list