[flang-commits] [flang] [flang][OpenACC] Generalize cross-region GOTO exit handling for all ACC region ops (PR #187613)

via flang-commits flang-commits at lists.llvm.org
Tue Mar 24 01:53:34 PDT 2026


================
@@ -3677,6 +3704,30 @@ class FirConverter : public Fortran::lower::AbstractConverter {
       localSymbols.popScope();
     builder->restoreInsertionPoint(insertPt);
 
+    // Generate jump table for GOTO exits from the ACC region.
+    if (needsExitSelector) {
+      auto exitInfo = accRegionExitStack.pop_back_val();
+      if (!exitInfo.exits.empty()) {
+        mlir::Location loc = toLocation();
+        mlir::Value sel = fir::LoadOp::create(*builder, loc, exitInfo.selector);
+        mlir::Block *continueBlock =
+            builder->getBlock()->splitBlock(builder->getBlock()->end());
----------------
jeanPerier wrote:

nit: I do not think you even need that and the mlir::cf::BranchOp, the last "nextCheck" should already create the next continuation block and the CondBranchOp will fall into it.

https://github.com/llvm/llvm-project/pull/187613


More information about the flang-commits mailing list