[flang] [llvm] [mlir] [flang][OpenMP] Enable tiling (PR #143715)
Sergio Afonso via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 28 08:58:08 PDT 2025
================
@@ -577,12 +598,53 @@ static void convertLoopBounds(lower::AbstractConverter &converter,
}
}
-bool collectLoopRelatedInfo(
+/// Populates the sizes vector with values if the given OpenMPConstruct
+/// contains a loop construct with an inner tiling construct.
+void collectTileSizesFromOpenMPConstruct(
+ const parser::OpenMPConstruct *ompCons,
+ llvm::SmallVectorImpl<int64_t> &tileSizes, SemanticsContext &semaCtx) {
+ if (!ompCons)
+ return;
+
+ if (auto *ompLoop{std::get_if<parser::OpenMPLoopConstruct>(&ompCons->u)}) {
+ const auto &nestedOptional =
+ std::get<std::optional<parser::NestedConstruct>>(ompLoop->t);
+ assert(nestedOptional.has_value() &&
+ "Expected a DoConstruct or OpenMPLoopConstruct");
+ const auto *innerConstruct =
+ std::get_if<common::Indirection<parser::OpenMPLoopConstruct>>(
+ &(nestedOptional.value()));
+ if (innerConstruct) {
+ const auto &innerLoopDirective = innerConstruct->value();
+ const auto &innerBegin =
+ std::get<parser::OmpBeginLoopDirective>(innerLoopDirective.t);
+ const auto &innerDirective =
+ std::get<parser::OmpLoopDirective>(innerBegin.t).v;
+
+ if (innerDirective == llvm::omp::Directive::OMPD_tile) {
+ // Get the size values from parse tree and convert to a vector
+ const auto &innerClauseList{
+ std::get<parser::OmpClauseList>(innerBegin.t)};
+ for (const auto &clause : innerClauseList.v)
----------------
skatrak wrote:
```suggestion
for (const auto &clause : innerClauseList.v) {
```
https://github.com/llvm/llvm-project/pull/143715
More information about the llvm-commits
mailing list