Skip to content

Commit 793c29a

Browse files
committed
[MLIR,OpenMP][NFCI] Removed loop for accessing regions of ParallelOp
`ParallelOp` has only one region associated with it. Reviewed By: kiranchandramohan, ftynse Differential Revision: https://reviews.llvm.org/D85008
1 parent e704aa4 commit 793c29a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,13 @@ ModuleTranslation::convertOmpParallel(Operation &opInst,
399399
llvm::Instruction *codeGenIPBBTI = codeGenIPBB->getTerminator();
400400

401401
builder.SetInsertPoint(codeGenIPBB);
402-
403-
for (auto &region : opInst.getRegions()) {
404-
for (auto &bb : region) {
405-
auto *llvmBB = llvm::BasicBlock::Create(
406-
llvmContext, "omp.par.region", codeGenIP.getBlock()->getParent());
407-
blockMapping[&bb] = llvmBB;
408-
}
402+
// ParallelOp has only `1` region associated with it.
403+
auto &region = cast<omp::ParallelOp>(opInst).getRegion();
404+
for (auto &bb : region) {
405+
auto *llvmBB = llvm::BasicBlock::Create(
406+
llvmContext, "omp.par.region", codeGenIP.getBlock()->getParent());
407+
blockMapping[&bb] = llvmBB;
408+
}
409409

410410
// Then, convert blocks one by one in topological order to ensure
411411
// defs are converted before uses.
@@ -433,7 +433,6 @@ ModuleTranslation::convertOmpParallel(Operation &opInst,
433433
// Finally, after all blocks have been traversed and values mapped,
434434
// connect the PHI nodes to the results of preceding blocks.
435435
connectPHINodes(region, valueMapping, blockMapping);
436-
}
437436
};
438437

439438
// TODO: Perform appropriate actions according to the data-sharing

0 commit comments

Comments
 (0)