[flang-commits] [flang] [flang] Lowering fortran structured do-while loops to `scf.while` (PR #177476)

Susan Tan ス-ザン タン via flang-commits flang-commits at lists.llvm.org
Mon Jan 26 12:47:59 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
----------------
SusanTan wrote:

yes that makes sense. I removed the logic. thanks!

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


More information about the flang-commits mailing list