[flang-commits] [flang] [flang] Fixed operations hoisting out of fir.do_concurrent. (PR #173502)
Slava Zakharin via flang-commits
flang-commits at lists.llvm.org
Thu Dec 25 21:29:56 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))
----------------
vzakhari wrote:
Thanks for the idea, but I am not sure checking for `PromotableAllocationOpInterface` is enough. In general, can't this interface be attached to something like `fir.allocmem` or `memref.alloc`? If it can, then we probably do not want to move `fir.allocmem` to the alloca-block without properly handling the pairing `fir.freemem`.
@Moxinilian, can `PromotableAllocationOpInterface` only be attached to operations allocating `AutomaticAllocationScopeResource` or there is no such limitation?
https://github.com/llvm/llvm-project/pull/173502
More information about the flang-commits
mailing list