[flang-commits] [flang] 3a3990c - [Flang][OpenMP] Move assert for wrapper syms and block args to genLoopNestOp (#103731)
via flang-commits
flang-commits at lists.llvm.org
Thu Aug 15 02:15:30 PDT 2024
Author: Sergio Afonso
Date: 2024-08-15T10:15:26+01:00
New Revision: 3a3990cb05858e7892a4825c677891a980f1cea8
URL: https://github.com/llvm/llvm-project/commit/3a3990cb05858e7892a4825c677891a980f1cea8
DIFF: https://github.com/llvm/llvm-project/commit/3a3990cb05858e7892a4825c677891a980f1cea8.diff
LOG: [Flang][OpenMP] Move assert for wrapper syms and block args to genLoopNestOp (#103731)
This patch adds an assert to `genLoopNestClauses` to ensure the number
of symbols and corresponding loop wrapper entry block arguments have the
same size. This is checked by some of the callers, but it makes more
sense moving it into the function itself and avoid having to replicate
it.
Added:
Modified:
flang/lib/Lower/OpenMP/OpenMP.cpp
Removed:
################################################################################
diff --git a/flang/lib/Lower/OpenMP/OpenMP.cpp b/flang/lib/Lower/OpenMP/OpenMP.cpp
index 95c55805dcabb3..64b581e8910d07 100644
--- a/flang/lib/Lower/OpenMP/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP/OpenMP.cpp
@@ -1371,6 +1371,9 @@ genLoopNestOp(lower::AbstractConverter &converter, lower::SymMap &symTable,
llvm::ArrayRef<const semantics::Symbol *> wrapperSyms,
llvm::ArrayRef<mlir::BlockArgument> wrapperArgs,
llvm::omp::Directive directive, DataSharingProcessor &dsp) {
+ assert(wrapperSyms.size() == wrapperArgs.size() &&
+ "Number of symbols and wrapper block arguments must match");
+
auto ivCallback = [&](mlir::Operation *op) {
genLoopVars(op, converter, loc, iv, wrapperSyms, wrapperArgs);
return llvm::SmallVector<const semantics::Symbol *>(iv);
@@ -2083,8 +2086,6 @@ static void genCompositeDistributeSimd(
llvm::concat<mlir::BlockArgument>(distributeOp.getRegion().getArguments(),
simdOp.getRegion().getArguments()));
- assert(wrapperArgs.empty() &&
- "Block args for omp.simd and omp.distribute currently not expected");
genLoopNestOp(converter, symTable, semaCtx, eval, loc, queue, item,
loopNestClauseOps, iv, /*wrapperSyms=*/{}, wrapperArgs,
llvm::omp::Directive::OMPD_distribute_simd, dsp);
@@ -2132,8 +2133,6 @@ static void genCompositeDoSimd(lower::AbstractConverter &converter,
auto wrapperArgs = llvm::to_vector(llvm::concat<mlir::BlockArgument>(
wsloopOp.getRegion().getArguments(), simdOp.getRegion().getArguments()));
- assert(wsloopReductionSyms.size() == wrapperArgs.size() &&
- "Number of symbols and wrapper block arguments must match");
genLoopNestOp(converter, symTable, semaCtx, eval, loc, queue, item,
loopNestClauseOps, iv, wsloopReductionSyms, wrapperArgs,
llvm::omp::Directive::OMPD_do_simd, dsp);
More information about the flang-commits
mailing list