@@ -399,13 +399,13 @@ ModuleTranslation::convertOmpParallel(Operation &opInst,
399
399
llvm::Instruction *codeGenIPBBTI = codeGenIPBB->getTerminator ();
400
400
401
401
builder.SetInsertPoint (codeGenIPBB);
402
-
403
- for ( auto ®ion : 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 ®ion = 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
+ }
409
409
410
410
// Then, convert blocks one by one in topological order to ensure
411
411
// defs are converted before uses.
@@ -433,7 +433,6 @@ ModuleTranslation::convertOmpParallel(Operation &opInst,
433
433
// Finally, after all blocks have been traversed and values mapped,
434
434
// connect the PHI nodes to the results of preceding blocks.
435
435
connectPHINodes (region, valueMapping, blockMapping);
436
- }
437
436
};
438
437
439
438
// TODO: Perform appropriate actions according to the data-sharing
0 commit comments