[all-commits] [llvm/llvm-project] d08b59: [flang] Let a directive keep the loop it owns when...

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Wed Sep 30 06:17:55 PDT 2026


  Branch: refs/heads/users/ergawy/acc-directive-owns-loop
  Home:   https://github.com/llvm/llvm-project
  Commit: d08b5994d06c652257364642af3e36ed4771945e
      https://github.com/llvm/llvm-project/commit/d08b5994d06c652257364642af3e36ed4771945e
  Author: ergawy <kareem.ergawy at gmail.com>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    M flang/lib/Lower/Bridge.cpp
    M flang/lib/Lower/PFTBuilder.cpp
    R flang/test/Lower/OpenACC/Todo/acc-unstructured-combined-construct.f90
    M flang/test/Lower/OpenACC/Todo/acc-unstructured-loop-construct.f90
    A flang/test/Lower/OpenACC/acc-directive-loop-bounds.f90
    A flang/test/Lower/OpenACC/acc-unstructured-combined-construct.f90
    M flang/test/Lower/OpenACC/acc-unstructured-internals.f90
    A flang/test/Lower/OpenACC/acc-unstructured-loop-construct.f90
    M flang/test/Lower/OpenACC/acc-unstructured.f90
    A flang/test/Lower/OpenMP/wsloop-directive-loop-bounds.f90

  Log Message:
  -----------
  [flang] Let a directive keep the loop it owns when its body branches

A loop whose branching is confined to its body keeps its structured
form, but the construct holding it stayed Unstructured. A directive does
not merely contain such a loop, it owns it, and its lowering reads the
construct's own classification to decide whether the loop op carries its
bounds. The directive was left with a bounds-free loop that nothing
could partition, and the loop it owns became a second one nested inside.

Reclassify a directive construct once the loops it holds no longer need
it to stay Unstructured. Children are visited first, so those loops have
already been reclassified by the time the construct is reached. A
construct whose branching leaves it is untouched, as is one holding a
branch of its own.

Taking a loop over also means genFIR(DoConstruct) -- where a plain loop
folds a body whose branching stays inside it into a region -- never runs
for that loop, so fold its body through the same helper. A construct
that takes over no loop, acc data or acc parallel without a loop
directive, keeps having its own evaluations lowered.

The cases this enables move out of the Todo tests, which asserted the
lowering was not yet implemented. The one whose EXIT leaves the loop
stays there.



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