[flang-commits] [flang] [fir] Support promoting `fir.do_loop` with results to `affine.for`. (PR #137790)

via flang-commits flang-commits at lists.llvm.org
Wed May 7 04:08:38 PDT 2025


================
@@ -461,14 +475,28 @@ class AffineLoopConversion : public mlir::OpRewritePattern<fir::DoLoopOp> {
     LLVM_ATTRIBUTE_UNUSED auto loopAnalysis =
         functionAnalysis.getChildLoopAnalysis(loop);
     auto &loopOps = loop.getBody()->getOperations();
+    auto resultOp = cast<fir::ResultOp>(loop.getBody()->getTerminator());
----------------
NexMing wrote:

My logic takes loops with multiple results into account, and I believe it can be successfully converted. I will add tests later to demonstrate this.

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


More information about the flang-commits mailing list