[flang-commits] [flang] [flang] Lowering fortran structured do-while loops to `scf.while` (PR #177476)
via flang-commits
flang-commits at lists.llvm.org
Mon Jan 26 06:53:44 PST 2026
================
@@ -1060,7 +1163,11 @@ class PFTBuilder {
eval.isUnstructured = true; // real-valued loop control
} else if (std::get_if<parser::ScalarLogicalExpr>(
&loopControl->u)) {
- eval.isUnstructured = true; // while loop
+ // DO WHILE structured/unstructured classification is handled by
+ // branch analysis plus the classifyDoWhiles() post-pass below
+ // when -lower-do-while-to-scf-while is enabled.
+ if (!Fortran::lower::lowerDoWhileToSCFWhile)
+ eval.isUnstructured = true; // while loop
----------------
jeanPerier wrote:
I do not understand why all the other changes to this file are needed. The visitor is already suposed to be doing some classification/analysis of the branches.
Aside from the loopControl, DO WHILE are structurally similar to DO LOOP and I was expecting the analysis that is already here would do everything already. Why did you need a custom handling for DO WHILE with classifyDoWhiles?
https://github.com/llvm/llvm-project/pull/177476
More information about the flang-commits
mailing list