[flang-commits] [flang] [flang] Fixed operations hoisting out of fir.do_concurrent. (PR #173502)

Kareem Ergawy via flang-commits flang-commits at lists.llvm.org
Wed Dec 24 23:58:32 PST 2025


================
@@ -262,8 +266,13 @@ class DoConcurrentConversion
         rewriter, doConcurentOp->getParentOfType<mlir::ModuleOp>());
     auto *allocIt = firBuilder.getAllocaBlock();
 
+    // Move alloca operations into the alloca-block, and all other
+    // operations - right before fir.do_concurrent.
     for (mlir::Operation *op : llvm::reverse(opsToMove))
-      rewriter.moveOpBefore(op, allocIt, allocIt->begin());
+      if (mlir::isa<fir::AllocaOp>(op))
----------------
ergawy wrote:

Just to be a bit more general-purpose?
```suggestion
      if (mlir::isa<mlir::PromotableAllocationOpInterface>(op))
```

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


More information about the flang-commits mailing list