[Mlir-commits] [mlir] 793c29a - [MLIR, OpenMP][NFCI] Removed loop for accessing regions of ParallelOp

Sourabh Singh Tomar llvmlistbot at llvm.org
Fri Jul 31 06:23:04 PDT 2020


Author: Sourabh Singh Tomar
Date: 2020-07-31T18:52:44+05:30
New Revision: 793c29a267ca85da84403e3bb032ea49eed9e5f7

URL: https://github.com/llvm/llvm-project/commit/793c29a267ca85da84403e3bb032ea49eed9e5f7
DIFF: https://github.com/llvm/llvm-project/commit/793c29a267ca85da84403e3bb032ea49eed9e5f7.diff

LOG: [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

Added: 
    

Modified: 
    mlir/lib/Target/LLVMIR/ModuleTranslation.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index 2c61f2a4ac11..6b068660d98f 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -399,13 +399,13 @@ ModuleTranslation::convertOmpParallel(Operation &opInst,
     llvm::Instruction *codeGenIPBBTI = codeGenIPBB->getTerminator();
 
     builder.SetInsertPoint(codeGenIPBB);
-
-    for (auto &region : opInst.getRegions()) {
-      for (auto &bb : region) {
-        auto *llvmBB = llvm::BasicBlock::Create(
-            llvmContext, "omp.par.region", codeGenIP.getBlock()->getParent());
-        blockMapping[&bb] = llvmBB;
-      }
+    // ParallelOp has only `1` region associated with it.
+    auto &region = cast<omp::ParallelOp>(opInst).getRegion();
+    for (auto &bb : region) {
+      auto *llvmBB = llvm::BasicBlock::Create(
+          llvmContext, "omp.par.region", codeGenIP.getBlock()->getParent());
+      blockMapping[&bb] = llvmBB;
+    }
 
       // Then, convert blocks one by one in topological order to ensure
       // defs are converted before uses.
@@ -433,7 +433,6 @@ ModuleTranslation::convertOmpParallel(Operation &opInst,
       // Finally, after all blocks have been traversed and values mapped,
       // connect the PHI nodes to the results of preceding blocks.
       connectPHINodes(region, valueMapping, blockMapping);
-    }
   };
 
   // TODO: Perform appropriate actions according to the data-sharing


        


More information about the Mlir-commits mailing list