[all-commits] [llvm/llvm-project] 4ef897: [flang] Lower loops whose branching is confined to...

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Fri Sep 25 02:37:24 PDT 2026


  Branch: refs/heads/users/ergawy/unstructured-lower-category-c
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ef89791ac1da2fc41ac527a511265bd25533a24
      https://github.com/llvm/llvm-project/commit/4ef89791ac1da2fc41ac527a511265bd25533a24
  Author: ergawy <kareem.ergawy at gmail.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M flang/include/flang/Lower/AbstractConverter.h
    M flang/include/flang/Lower/PFTBuilder.h
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/lib/Lower/PFTBuilder.cpp
    M flang/test/Lower/OpenACC/acc-cache.f90
    A flang/test/Lower/OpenACC/acc-unstructured-internals.f90
    M flang/test/Lower/OpenACC/acc-unstructured.f90
    R flang/test/Lower/OpenMP/Todo/metadirective-loop-unstructured.f90
    A flang/test/Lower/OpenMP/metadirective-loop-unstructured.f90
    M flang/test/Lower/OpenMP/wsloop-unstructured-cycle.f90
    A flang/test/Lower/OpenMP/wsloop-unstructured-internals.f90
    M flang/test/Lower/always-execute-loop-body.f90
    A flang/test/Lower/do-loop-branch-to-loop-header.f90
    M flang/test/Lower/do_loop_unstructured.f90
    M flang/test/Lower/select-case-statement.f90

  Log Message:
  -----------
  [flang] Lower loops whose branching is confined to their body structurally

Such a loop was classified separately by a previous change but still
lowered as unstructured, so its structured form was lost.

Lower it structurally instead, with its body folded into a region that can
hold the branching. The loop keeps its bounds on the op, so it remains
available to whatever transforms or parallelizes it. Only the body is
folded: the loop control statements are emitted as they are for any
structured loop, since a branch from outside may target either of them.

Loops an OpenACC or OpenMP directive owns are lowered the same way, so
they keep their form too.


  Commit: 245f71a9e62f62559208fa7c9a659de6df2a2217
      https://github.com/llvm/llvm-project/commit/245f71a9e62f62559208fa7c9a659de6df2a2217
  Author: ergawy <kareem.ergawy at gmail.com>
  Date:   2026-09-25 (Fri, 25 Sep 2026)

  Changed paths:
    M flang/test/Lower/do-loop-infinite-body-cycle.f90

  Log Message:
  -----------
  [flang][Test] Cover the lowering of loops with a non-terminating body

A previous change leaves such a loop unstructured. Check what that produces:
the cycle survives as a block branching to itself, no fir.do_loop is emitted
for the loop control, and a loop that only needs a block of its own still
gets the structured form with its body in a region.


Compare: https://github.com/llvm/llvm-project/compare/99c4b4871512...245f71a9e62f

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list