[flang-commits] [flang] d2f1f53 - [flang][OpenMP] Place the insertion point to the start of the block

Sourabh Singh Tomar via flang-commits flang-commits at lists.llvm.org
Fri Sep 25 11:27:02 PDT 2020


Author: Sourabh Singh Tomar
Date: 2020-09-25T23:56:41+05:30
New Revision: d2f1f530430e9dbdd69c3ed173ced076f4bb933e

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

LOG: [flang][OpenMP] Place the insertion point to the start of the block

After skeleton of the `Parallel Op` is created set the insertion point to start of the block. So that later `CodeGen` can proceed.

Note: This patch reflects the work that can be upstreamed from PR(merged)
PR: https://github.com/flang-compiler/f18-llvm-project/pull/424

Reviewed By: schweitz, kiranchandramohan

Differential Revision: https://reviews.llvm.org/D88221

Added: 
    

Modified: 
    flang/lib/Lower/OpenMP.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Lower/OpenMP.cpp b/flang/lib/Lower/OpenMP.cpp
index 75ddfba65e67..694ef7e33d76 100644
--- a/flang/lib/Lower/OpenMP.cpp
+++ b/flang/lib/Lower/OpenMP.cpp
@@ -87,7 +87,6 @@ genOMP(Fortran::lower::AbstractConverter &converter,
   if (parallelDirective.v == llvm::omp::OMPD_parallel) {
     auto &firOpBuilder = converter.getFirOpBuilder();
     auto currentLocation = converter.getCurrentLocation();
-    auto insertPt = firOpBuilder.saveInsertionPoint();
 
     // Clauses.
     // FIXME: Add support for other clauses.
@@ -117,7 +116,9 @@ genOMP(Fortran::lower::AbstractConverter &converter,
     firOpBuilder.setInsertionPointToStart(&block);
     // Ensure the block is well-formed.
     firOpBuilder.create<mlir::omp::TerminatorOp>(currentLocation);
-    firOpBuilder.restoreInsertionPoint(insertPt);
+
+    // Place the insertion point to the start of the first block.
+    firOpBuilder.setInsertionPointToStart(&block);
   }
 }
 


        


More information about the flang-commits mailing list