[flang-commits] [flang] [flang] Lowering fortran structured do-while loops to `scf.while` (PR #177476)
via flang-commits
flang-commits at lists.llvm.org
Fri Jan 23 01:12:47 PST 2026
================
@@ -1644,6 +1650,111 @@ class FirConverter : public Fortran::lower::AbstractConverter {
genConditionalBranch(cond, trueTarget->block, falseTarget->block);
}
+ bool doWhileHasEarlyExit(const Fortran::lower::pft::Evaluation &outerDoWhile,
----------------
jeanPerier wrote:
I think the PFT logic should be changed instead so that it does not flag all DO WHILE as unstructuredContext.
The PFT is in charge of looking for early exits.
So I think that if you add your switch to control the setting of `eval.isUnstructured` [here ](https://github.com/llvm/llvm-project/blob/e85bbd09491f3409cf4d844e6f57e91ab028defa/flang/lib/Lower/PFTBuilder.cpp#L1063), you can then remove `doWhileHasEarlyExit` and use `unstructuredContext` in Bridge.cpp to control the generation of scf vs cf.
https://github.com/llvm/llvm-project/pull/177476
More information about the flang-commits
mailing list