Skip to content

Commit 7835371

Browse files
committed
Review nits
1 parent 098611a commit 7835371

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1400,21 +1400,22 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
14001400
Region &allocRegion = privateDecls[i].getAllocRegion();
14011401

14021402
// map allocation region block argument
1403-
llvm::Value *llvmArg =
1403+
llvm::Value *nonPrivateVar =
14041404
moduleTranslation.lookupValue(opInst.getPrivateVars()[i]);
1405-
assert(llvmArg);
1406-
moduleTranslation.mapValue(allocRegion.getArgument(0), llvmArg);
1405+
assert(nonPrivateVar);
1406+
moduleTranslation.mapValue(allocRegion.getArgument(0), nonPrivateVar);
14071407

14081408
// in-place convert the private allocation region
14091409
SmallVector<llvm::Value *, 1> phis;
1410-
if (allocRegion.getArgument(0).getUses().empty())
1410+
if (allocRegion.getArgument(0).getUses().empty()) {
14111411
// TODO this should use
14121412
// allocaIP.getBlock()->getFirstNonPHIOrDbgOrAlloca() so it goes before
14131413
// the code for fetching the thread id. Not doing this for now to avoid
14141414
// test churn.
14151415
builder.SetInsertPoint(allocaIP.getBlock()->getTerminator());
1416-
else
1416+
} else {
14171417
builder.SetInsertPoint(privAllocBlock->getTerminator());
1418+
}
14181419
if (failed(inlineConvertOmpRegions(allocRegion, "omp.private.alloc",
14191420
builder, moduleTranslation, &phis))) {
14201421
bodyGenStatus = failure();
@@ -1453,7 +1454,8 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
14531454
assert(afterAllocas->getSinglePredecessor());
14541455
builder.SetInsertPoint(
14551456
afterAllocas->getSinglePredecessor()->getTerminator());
1456-
llvm::BasicBlock *copyBlock = splitBB(builder, true, "omp.private.copy");
1457+
llvm::BasicBlock *copyBlock =
1458+
splitBB(builder, /*CreateBranch=*/true, "omp.private.copy");
14571459
builder.SetInsertPoint(copyBlock->getFirstNonPHIOrDbgOrAlloca());
14581460
}
14591461
for (unsigned i = 0; i < privateBlockArgs.size(); ++i) {
@@ -1481,7 +1483,7 @@ convertOmpParallel(omp::ParallelOp opInst, llvm::IRBuilderBase &builder,
14811483
return;
14821484
}
14831485

1484-
// ignore unused value yielded value from copy region
1486+
// ignore unused value yielded from copy region
14851487

14861488
// clear copy region block argument mapping in case it needs to be
14871489
// re-created with different sources for reuse of the same reduction

0 commit comments

Comments
 (0)