Skip to content

Commit e16220e

Browse files
committed
Don't generate firstprivate copy block if there are no firstprivate variables
1 parent 7835371 commit e16220e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1449,7 +1449,12 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
14491449
bodyGenStatus = failure();
14501450

14511451
// Apply copy region for firstprivate.
1452-
if (!privateBlockArgs.empty()) {
1452+
bool needsFirstprivate =
1453+
llvm::any_of(privateDecls, [](omp::PrivateClauseOp &privOp) {
1454+
return privOp.getDataSharingType() ==
1455+
omp::DataSharingClauseType::FirstPrivate;
1456+
});
1457+
if (needsFirstprivate) {
14531458
// Find the end of the allocation blocks
14541459
assert(afterAllocas->getSinglePredecessor());
14551460
builder.SetInsertPoint(

0 commit comments

Comments
 (0)