[llvm-branch-commits] [flang] [flang] Lower loops whose branching is confined to their body structurally (PR #225758)
Kareem Ergawy via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Sep 25 02:40:42 PDT 2026
================
@@ -2642,6 +2647,97 @@ class FirConverter : public Fortran::lower::AbstractConverter {
return wrapOp;
}
+ /// Wrap a loop's *body* -- not the construct, and not the loop control -- in
+ /// an scf.execute_region. A category (c) loop keeps its structured loop op
+ /// while its self-contained raw branching lives inside the region, which may
+ /// hold as many blocks as it needs.
+ ///
+ /// The builder must already be positioned inside the loop body. On return it
+ /// is inside the region. Returns null when the loop has no such internals.
+ mlir::scf::ExecuteRegionOp
+ wrapUnstructuredBody(Fortran::lower::pft::Evaluation &eval,
+ mlir::Block *&yieldBlock,
+ mlir::Block *&savedEndDoBlock) {
+ if (!eval.lowerBodyAsWrappedRegion())
----------------
ergawy wrote:
Done in 6cc6a642e05a61b9a502bae21fc19a2d4e39827c (https://github.com/llvm/llvm-project/pull/225757).
https://github.com/llvm/llvm-project/pull/225758
More information about the llvm-branch-commits
mailing list