[llvm-branch-commits] [flang] [llvm] [Flang][OpenMP] Prevent re-composition of composite constructs (PR #102613)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Aug 9 06:04:39 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-openmp
Author: Sergio Afonso (skatrak)
<details>
<summary>Changes</summary>
After decomposition of OpenMP compound constructs and assignment of applicable clauses to each leaf construct, composite constructs are then combined again into a single element in the construct queue. This helped later lowering stages easily identify composite constructs.
However, as a result of the re-composition stage, the same list of clauses is used to produce all MLIR operations corresponding to each leaf of the original composite construct. This undoes existing logic introducing implicit clauses and deciding to which leaf construct(s) each clause applies.
This patch removes construct re-composition logic and updates Flang lowering to be able to identify composite constructs from a list of leaf constructs. As a result, the right set of clauses is produced for each operation representing a leaf of a composite construct.
---
Patch is 34.12 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/102613.diff
7 Files Affected:
- (modified) flang/lib/Lower/OpenMP/Decomposer.cpp (+22-34)
- (modified) flang/lib/Lower/OpenMP/Decomposer.h (+6-1)
- (modified) flang/lib/Lower/OpenMP/OpenMP.cpp (+70-23)
- (modified) flang/test/Lower/OpenMP/Todo/omp-do-simd-linear.f90 (+1-1)
- (modified) flang/test/Lower/OpenMP/default-clause-byref.f90 (+2-2)
- (modified) flang/test/Lower/OpenMP/default-clause.f90 (+2-2)
- (removed) llvm/include/llvm/Frontend/OpenMP/ConstructCompositionT.h (-425)
``````````diff
diff --git a/flang/lib/Lower/OpenMP/Decomposer.cpp b/flang/lib/Lower/OpenMP/Decomposer.cpp
index dfd85897469e28..5a7b1078bdd414 100644
--- a/flang/lib/Lower/OpenMP/Decomposer.cpp
+++ b/flang/lib/Lower/OpenMP/Decomposer.cpp
@@ -22,7 +22,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Frontend/OpenMP/ClauseT.h"
-#include "llvm/Frontend/OpenMP/ConstructCompositionT.h"
#include "llvm/Frontend/OpenMP/ConstructDecompositionT.h"
#include "llvm/Frontend/OpenMP/OMP.h"
#include "llvm/Support/raw_ostream.h"
@@ -68,12 +67,6 @@ struct ConstructDecomposition {
};
} // namespace
-static UnitConstruct mergeConstructs(uint32_t version,
- llvm::ArrayRef<UnitConstruct> units) {
- tomp::ConstructCompositionT compose(version, units);
- return compose.merged;
-}
-
namespace Fortran::lower::omp {
LLVM_DUMP_METHOD llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
const UnitConstruct &uc) {
@@ -90,38 +83,33 @@ ConstructQueue buildConstructQueue(
Fortran::lower::pft::Evaluation &eval, const parser::CharBlock &source,
llvm::omp::Directive compound, const List<Clause> &clauses) {
- List<UnitConstruct> constructs;
-
ConstructDecomposition decompose(modOp, semaCtx, eval, compound, clauses);
assert(!decompose.output.empty() && "Construct decomposition failed");
- llvm::SmallVector<llvm::omp::Directive> loweringUnits;
- std::ignore =
- llvm::omp::getLeafOrCompositeConstructs(compound, loweringUnits);
- uint32_t version = getOpenMPVersionAttribute(modOp);
-
- int leafIndex = 0;
- for (llvm::omp::Directive dir_id : loweringUnits) {
- llvm::ArrayRef<llvm::omp::Directive> leafsOrSelf =
- llvm::omp::getLeafConstructsOrSelf(dir_id);
- size_t numLeafs = leafsOrSelf.size();
-
- llvm::ArrayRef<UnitConstruct> toMerge{&decompose.output[leafIndex],
- numLeafs};
- auto &uc = constructs.emplace_back(mergeConstructs(version, toMerge));
-
- if (!transferLocations(clauses, uc.clauses)) {
- // If some clauses are left without source information, use the
- // directive's source.
- for (auto &clause : uc.clauses) {
- if (clause.source.empty())
- clause.source = source;
- }
- }
- leafIndex += numLeafs;
+ for (UnitConstruct &uc : decompose.output) {
+ assert(getLeafConstructs(uc.id).empty() && "unexpected compound directive");
+ // If some clauses are left without source information, use the directive's
+ // source.
+ for (auto &clause : uc.clauses)
+ if (clause.source.empty())
+ clause.source = source;
}
- return constructs;
+ return decompose.output;
+}
+
+bool matchLeafSequence(ConstructQueue::const_iterator item,
+ const ConstructQueue &queue,
+ llvm::ArrayRef<llvm::omp::Directive> directives) {
+ for (auto [dir, leaf] :
+ llvm::zip_longest(directives, llvm::make_range(item, queue.end()))) {
+ if (!dir || !leaf)
+ return false;
+
+ if (dir.value() != leaf.value().id)
+ return false;
+ }
+ return true;
}
bool isLastItemInQueue(ConstructQueue::const_iterator item,
diff --git a/flang/lib/Lower/OpenMP/Decomposer.h b/flang/lib/Lower/OpenMP/Decomposer.h
index e85956ffe1a231..6c90e8540d459b 100644
--- a/flang/lib/Lower/OpenMP/Decomposer.h
+++ b/flang/lib/Lower/OpenMP/Decomposer.h
@@ -10,7 +10,6 @@
#include "Clauses.h"
#include "mlir/IR/BuiltinOps.h"
-#include "llvm/Frontend/OpenMP/ConstructCompositionT.h"
#include "llvm/Frontend/OpenMP/ConstructDecompositionT.h"
#include "llvm/Frontend/OpenMP/OMP.h"
#include "llvm/Support/Compiler.h"
@@ -49,6 +48,12 @@ ConstructQueue buildConstructQueue(mlir::ModuleOp modOp,
bool isLastItemInQueue(ConstructQueue::const_iterator item,
const ConstructQueue &queue);
+
+/// Try to match a sequence of \c directives to the range of leaf constructs
+/// starting from \c item to the end of the \c queue.
+bool matchLeafSequence(ConstructQueue::const_iterator item,
+ const ConstructQueue &queue,
+ llvm::ArrayRef<llvm::omp::Directive> directives);
} // namespace Fortran::lower::omp
#endif // FORTRAN_LOWER_OPENMP_DECOMPOSER_H
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 14723360f0ee1c..b8ca13eb025fca 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -2042,6 +2042,7 @@ static void genCompositeDistributeParallelDoSimd(
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
mlir::Location loc, const ConstructQueue &queue,
ConstructQueue::const_iterator item, DataSharingProcessor &dsp) {
+ assert(std::distance(item, queue.end()) == 4 && "Invalid leaf constructs");
TODO(loc, "Composite DISTRIBUTE PARALLEL DO SIMD");
}
@@ -2052,17 +2053,23 @@ static void genCompositeDistributeSimd(
ConstructQueue::const_iterator item, DataSharingProcessor &dsp) {
lower::StatementContext stmtCtx;
+ assert(std::distance(item, queue.end()) == 2 && "Invalid leaf constructs");
+ ConstructQueue::const_iterator distributeItem = item;
+ ConstructQueue::const_iterator simdItem = std::next(distributeItem);
+
// Clause processing.
mlir::omp::DistributeOperands distributeClauseOps;
- genDistributeClauses(converter, semaCtx, stmtCtx, item->clauses, loc,
- distributeClauseOps);
+ genDistributeClauses(converter, semaCtx, stmtCtx, distributeItem->clauses,
+ loc, distributeClauseOps);
mlir::omp::SimdOperands simdClauseOps;
- genSimdClauses(converter, semaCtx, item->clauses, loc, simdClauseOps);
+ genSimdClauses(converter, semaCtx, simdItem->clauses, loc, simdClauseOps);
+ // Pass the innermost leaf construct's clauses because that's where COLLAPSE
+ // is placed by construct decomposition.
mlir::omp::LoopNestOperands loopNestClauseOps;
llvm::SmallVector<const semantics::Symbol *> iv;
- genLoopNestClauses(converter, semaCtx, eval, item->clauses, loc,
+ genLoopNestClauses(converter, semaCtx, eval, simdItem->clauses, loc,
loopNestClauseOps, iv);
// Operation creation.
@@ -2084,7 +2091,7 @@ static void genCompositeDistributeSimd(
assert(wrapperArgs.empty() &&
"Block args for omp.simd and omp.distribute currently not expected");
- genLoopNestOp(converter, symTable, semaCtx, eval, loc, queue, item,
+ genLoopNestOp(converter, symTable, semaCtx, eval, loc, queue, simdItem,
loopNestClauseOps, iv, /*wrapperSyms=*/{}, wrapperArgs,
llvm::omp::Directive::OMPD_distribute_simd, dsp);
}
@@ -2098,19 +2105,25 @@ static void genCompositeDoSimd(lower::AbstractConverter &converter,
DataSharingProcessor &dsp) {
lower::StatementContext stmtCtx;
+ assert(std::distance(item, queue.end()) == 2 && "Invalid leaf constructs");
+ ConstructQueue::const_iterator doItem = item;
+ ConstructQueue::const_iterator simdItem = std::next(doItem);
+
// Clause processing.
mlir::omp::WsloopOperands wsloopClauseOps;
llvm::SmallVector<const semantics::Symbol *> wsloopReductionSyms;
llvm::SmallVector<mlir::Type> wsloopReductionTypes;
- genWsloopClauses(converter, semaCtx, stmtCtx, item->clauses, loc,
+ genWsloopClauses(converter, semaCtx, stmtCtx, doItem->clauses, loc,
wsloopClauseOps, wsloopReductionTypes, wsloopReductionSyms);
mlir::omp::SimdOperands simdClauseOps;
- genSimdClauses(converter, semaCtx, item->clauses, loc, simdClauseOps);
+ genSimdClauses(converter, semaCtx, simdItem->clauses, loc, simdClauseOps);
+ // Pass the innermost leaf construct's clauses because that's where COLLAPSE
+ // is placed by construct decomposition.
mlir::omp::LoopNestOperands loopNestClauseOps;
llvm::SmallVector<const semantics::Symbol *> iv;
- genLoopNestClauses(converter, semaCtx, eval, item->clauses, loc,
+ genLoopNestClauses(converter, semaCtx, eval, simdItem->clauses, loc,
loopNestClauseOps, iv);
// Operation creation.
@@ -2131,7 +2144,7 @@ static void genCompositeDoSimd(lower::AbstractConverter &converter,
assert(wsloopReductionSyms.size() == wrapperArgs.size() &&
"Number of symbols and wrapper block arguments must match");
- genLoopNestOp(converter, symTable, semaCtx, eval, loc, queue, item,
+ genLoopNestOp(converter, symTable, semaCtx, eval, loc, queue, simdItem,
loopNestClauseOps, iv, wsloopReductionSyms, wrapperArgs,
llvm::omp::Directive::OMPD_do_simd, dsp);
}
@@ -2141,6 +2154,7 @@ static void genCompositeTaskloopSimd(
semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
mlir::Location loc, const ConstructQueue &queue,
ConstructQueue::const_iterator item, DataSharingProcessor &dsp) {
+ assert(std::distance(item, queue.end()) == 2 && "Invalid leaf constructs");
TODO(loc, "Composite TASKLOOP SIMD");
}
@@ -2148,6 +2162,42 @@ static void genCompositeTaskloopSimd(
// Dispatch
//===----------------------------------------------------------------------===//
+static bool genOMPCompositeDispatch(
+ lower::AbstractConverter &converter, lower::SymMap &symTable,
+ semantics::SemanticsContext &semaCtx, lower::pft::Evaluation &eval,
+ mlir::Location loc, const ConstructQueue &queue,
+ ConstructQueue::const_iterator item, DataSharingProcessor &dsp) {
+ using llvm::omp::Directive;
+ using llvm::omp::getLeafConstructs, lower::omp::matchLeafSequence;
+
+ if (matchLeafSequence(
+ item, queue,
+ getLeafConstructs(Directive::OMPD_distribute_parallel_do)))
+ genCompositeDistributeParallelDo(converter, symTable, semaCtx, eval, loc,
+ queue, item, dsp);
+ else if (matchLeafSequence(
+ item, queue,
+ getLeafConstructs(Directive::OMPD_distribute_parallel_do_simd)))
+ genCompositeDistributeParallelDoSimd(converter, symTable, semaCtx, eval,
+ loc, queue, item, dsp);
+ else if (matchLeafSequence(
+ item, queue, getLeafConstructs(Directive::OMPD_distribute_simd)))
+ genCompositeDistributeSimd(converter, symTable, semaCtx, eval, loc, queue,
+ item, dsp);
+ else if (matchLeafSequence(item, queue,
+ getLeafConstructs(Directive::OMPD_do_simd)))
+ genCompositeDoSimd(converter, symTable, semaCtx, eval, loc, queue, item,
+ dsp);
+ else if (matchLeafSequence(item, queue,
+ getLeafConstructs(Directive::OMPD_taskloop_simd)))
+ genCompositeTaskloopSimd(converter, symTable, semaCtx, eval, loc, queue,
+ item, dsp);
+ else
+ return false;
+
+ return true;
+}
+
static void genOMPDispatch(lower::AbstractConverter &converter,
lower::SymMap &symTable,
semantics::SemanticsContext &semaCtx,
@@ -2161,10 +2211,18 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
llvm::omp::Association::Loop;
if (loopLeaf) {
symTable.pushScope();
+ // TODO: Use one DataSharingProcessor for each leaf of a composite
+ // construct.
loopDsp.emplace(converter, semaCtx, item->clauses, eval,
/*shouldCollectPreDeterminedSymbols=*/true,
/*useDelayedPrivatization=*/false, &symTable);
loopDsp->processStep1();
+
+ if (genOMPCompositeDispatch(converter, symTable, semaCtx, eval, loc, queue,
+ item, *loopDsp)) {
+ symTable.popScope();
+ return;
+ }
}
switch (llvm::omp::Directive dir = item->id) {
@@ -2263,24 +2321,13 @@ static void genOMPDispatch(lower::AbstractConverter &converter,
// Composite constructs
case llvm::omp::Directive::OMPD_distribute_parallel_do:
- genCompositeDistributeParallelDo(converter, symTable, semaCtx, eval, loc,
- queue, item, *loopDsp);
- break;
case llvm::omp::Directive::OMPD_distribute_parallel_do_simd:
- genCompositeDistributeParallelDoSimd(converter, symTable, semaCtx, eval,
- loc, queue, item, *loopDsp);
- break;
case llvm::omp::Directive::OMPD_distribute_simd:
- genCompositeDistributeSimd(converter, symTable, semaCtx, eval, loc, queue,
- item, *loopDsp);
- break;
case llvm::omp::Directive::OMPD_do_simd:
- genCompositeDoSimd(converter, symTable, semaCtx, eval, loc, queue, item,
- *loopDsp);
- break;
case llvm::omp::Directive::OMPD_taskloop_simd:
- genCompositeTaskloopSimd(converter, symTable, semaCtx, eval, loc, queue,
- item, *loopDsp);
+ // Composite constructs should have been split into a sequence of leaf
+ // constructs and lowered by genOMPCompositeDispatch().
+ llvm_unreachable("Unexpected composite construct.");
break;
default:
break;
diff --git a/flang/test/Lower/OpenMP/Todo/omp-do-simd-linear.f90 b/flang/test/Lower/OpenMP/Todo/omp-do-simd-linear.f90
index 2f5366c2a5b368..4caf12a0169c42 100644
--- a/flang/test/Lower/OpenMP/Todo/omp-do-simd-linear.f90
+++ b/flang/test/Lower/OpenMP/Todo/omp-do-simd-linear.f90
@@ -4,7 +4,7 @@
! RUN: %not_todo_cmd %flang_fc1 -emit-fir -fopenmp -o - %s 2>&1 | FileCheck %s
subroutine testDoSimdLinear(int_array)
integer :: int_array(*)
-!CHECK: not yet implemented: Unhandled clause LINEAR in DO construct
+!CHECK: not yet implemented: Unhandled clause LINEAR in SIMD construct
!$omp do simd linear(int_array)
do index_ = 1, 10
end do
diff --git a/flang/test/Lower/OpenMP/default-clause-byref.f90 b/flang/test/Lower/OpenMP/default-clause-byref.f90
index d9f0eff4e6fde1..626ba3335a8c10 100644
--- a/flang/test/Lower/OpenMP/default-clause-byref.f90
+++ b/flang/test/Lower/OpenMP/default-clause-byref.f90
@@ -197,9 +197,9 @@ subroutine nested_default_clause_tests
!CHECK: %[[Y_DECL:.*]]:2 = hlfir.declare %[[Y]] {uniq_name = "_QFnested_default_clause_testsEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFnested_default_clause_testsEz"}
!CHECK: %[[Z_DECL:.*]]:2 = hlfir.declare %[[Z]] {uniq_name = "_QFnested_default_clause_testsEz"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
-!CHECK: omp.parallel private({{.*}} {{.*}}#0 -> %[[PRIVATE_Y:.*]] : {{.*}}, {{.*firstprivate.*}} {{.*}}#0 -> %[[PRIVATE_X:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_Z:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_K:.*]] : {{.*}}) {
-!CHECK: %[[PRIVATE_Y_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Y]] {uniq_name = "_QFnested_default_clause_testsEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+!CHECK: omp.parallel private({{.*firstprivate.*}} {{.*}}#0 -> %[[PRIVATE_X:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_Y:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_Z:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_K:.*]] : {{.*}}) {
!CHECK: %[[PRIVATE_X_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_X]] {uniq_name = "_QFnested_default_clause_testsEx"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+!CHECK: %[[PRIVATE_Y_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Y]] {uniq_name = "_QFnested_default_clause_testsEy"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[PRIVATE_Z_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Z]] {uniq_name = "_QFnested_default_clause_testsEz"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[PRIVATE_K_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_K]] {uniq_name = "_QFnested_default_clause_testsEk"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: omp.parallel private({{.*}} {{.*}}#0 -> %[[INNER_PRIVATE_Y:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[INNER_PRIVATE_X:.*]] : {{.*}}) {
diff --git a/flang/test/Lower/OpenMP/default-clause.f90 b/flang/test/Lower/OpenMP/default-clause.f90
index 775ce9ac801934..fefb5fcc4239e6 100644
--- a/flang/test/Lower/OpenMP/default-clause.f90
+++ b/flang/test/Lower/OpenMP/default-clause.f90
@@ -134,9 +134,9 @@ end program default_clause_lowering
!CHECK: %[[Y_DECL:.*]]:2 = hlfir.declare %[[Y]] {uniq_name = "_QFnested_default_clause_test1Ey"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[Z:.*]] = fir.alloca i32 {bindc_name = "z", uniq_name = "_QFnested_default_clause_test1Ez"}
!CHECK: %[[Z_DECL:.*]]:2 = hlfir.declare %[[Z]] {uniq_name = "_QFnested_default_clause_test1Ez"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
-!CHECK: omp.parallel private({{.*}} {{.*}}#0 -> %[[PRIVATE_Y:.*]] : {{.*}}, {{.*firstprivate.*}} {{.*}}#0 -> %[[PRIVATE_X:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_Z:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_K:.*]] : {{.*}}) {
-!CHECK: %[[PRIVATE_Y_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Y]] {uniq_name = "_QFnested_default_clause_test1Ey"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+!CHECK: omp.parallel private({{.*firstprivate.*}} {{.*}}#0 -> %[[PRIVATE_X:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_Y:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_Z:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[PRIVATE_K:.*]] : {{.*}}) {
!CHECK: %[[PRIVATE_X_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_X]] {uniq_name = "_QFnested_default_clause_test1Ex"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
+!CHECK: %[[PRIVATE_Y_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Y]] {uniq_name = "_QFnested_default_clause_test1Ey"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[PRIVATE_Z_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_Z]] {uniq_name = "_QFnested_default_clause_test1Ez"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: %[[PRIVATE_K_DECL:.*]]:2 = hlfir.declare %[[PRIVATE_K]] {uniq_name = "_QFnested_default_clause_test1Ek"} : (!fir.ref<i32>) -> (!fir.ref<i32>, !fir.ref<i32>)
!CHECK: omp.parallel private({{.*}} {{.*}}#0 -> %[[INNER_PRIVATE_Y:.*]] : {{.*}}, {{.*}} {{.*}}#0 -> %[[INNER_PRIVATE_X:.*]] : {{.*}}) {
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructCompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructCompositionT.h
deleted file mode 100644
index b3a02cd5312170..00000000000000
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructCompositionT.h
+++ /dev/null
@@ -1,425 +0,0 @@
-//===- ConstructCompositionT.h -- Composing compound constructs -----------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-// Given a list of leaf construct, each with a set of clauses, generate the
-// compound construct whose leaf constructs are the given list, and whose clause
-// list is the merged lists of individual leaf clauses.
-//
-// *** At the moment it assumes that the individual constructs and their clauses
-// *** are a subset of those created by splitting a valid compound construct.
-//===----------------------------------------------------------------------===//
-#ifndef LLVM_FRONTEND_OPENMP_CONSTRUCTCOMPOSITIONT_H
-#define LLVM_FRONTEND_OPENMP_CONSTRUCTCOMPOSITIONT_H
-
-#include "llvm/ADT/ArrayRef.h"
-#include "llvm/ADT/BitVector.h"
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Frontend/OpenMP/ClauseT.h"
-#include "llvm/Frontend/OpenMP/OMP.h"
-
-#include <iterator>
-#include <optional>
-#include <tuple>
-#include <unordered_map>
-#include <unordered_set>
-#include <utility>
-
-namespace tomp {
-template <typename ClauseType> struct ConstructCompositionT {
- using ClauseTy = ClauseType;
-
- using TypeTy = typename ClauseTy::TypeTy;
- using IdTy = typename ClauseTy::IdTy;
- using ExprTy = typename ClauseTy::ExprTy;
-
- ConstructCompositionT(uint32_t version,
- llvm::ArrayRef<DirectiveWithClauses<ClauseTy>> leafs);
-
- DirectiveWithClauses<ClauseTy> merged;
-
-private:
- // Use an ordered container, since we beed to maintain the order in which
- // clauses are added to it. This is to avoid non-deterministic output.
- using ClauseSet = ListT<ClauseTy>;
-
- enum class Presence {
- All, // Clause is preesnt on all leaf constructs that allow it.
- Some, //...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/102613
More information about the llvm-branch-commits
mailing list