[flang-commits] [flang] [Flang][OpenMP] Add semantic support for Loop Sequences and OpenMP loop fuse (PR #161213)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Tue Oct 28 10:13:26 PDT 2025
================
@@ -452,6 +456,65 @@ void OmpStructureChecker::CheckDistLinear(
}
}
+void OmpStructureChecker::CheckLooprangeBounds(
+ const parser::OpenMPLoopConstruct &x) {
+ const parser::OmpClauseList &clauseList = x.BeginDir().Clauses();
+ if (!clauseList.v.empty()) {
+ for (auto &clause : clauseList.v) {
+ if (const auto *lrClause{
+ std::get_if<parser::OmpClause::Looprange>(&clause.u)}) {
+ if (const auto first{GetIntValue(std::get<0>((lrClause->v).t))}) {
+ if (const auto count{GetIntValue(std::get<1>((lrClause->v).t))}) {
+ auto &loopConsList =
+ std::get<std::list<parser::NestedConstruct>>(x.t);
+ if (*first > 0 && *count > 0 &&
+ loopConsList.size() < (unsigned)(*first + *count - 1)) {
+ context_.Say(clause.source,
+ "The loop range indicated in the %s clause"
+ " must not be out of the bounds of the Loop Sequence"
+ " following the construct."_err_en_US,
+ parser::ToUpperCaseLetters(clause.source.ToString()));
+ }
+ }
+ }
+ return;
+ }
+ }
+ }
+}
+
+void OmpStructureChecker::CheckNestedFuse(
+ const parser::OpenMPLoopConstruct &x) {
+ auto &loopConsList = std::get<std::list<parser::NestedConstruct>>(x.t);
+ for (auto &loopCons : loopConsList) {
+ if (const auto &ompConstruct{
----------------
kparzysz wrote:
Same comments as above, here and in other places in the loop. Please keep the indentation reasonable.
https://github.com/llvm/llvm-project/pull/161213
More information about the flang-commits
mailing list