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

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Wed May 7 03:07:05 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());
----------------
tblah wrote:

Please modify the logic to skip loops which are unsupported (those with multiple results). Otherwise this could produce incorrect code.

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


More information about the flang-commits mailing list