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

Kareem Ergawy via All-commits all-commits at lists.llvm.org
Wed Sep 30 11:59:53 PDT 2026


  Branch: refs/heads/users/ergawy/acc-directive-owns-loop
  Home:   https://github.com/llvm/llvm-project
  Commit: 4ccc6eb4f8d91ccef13620de2846297f65c5c946
      https://github.com/llvm/llvm-project/commit/4ccc6eb4f8d91ccef13620de2846297f65c5c946
  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.


  Commit: 5706639779ad17cfaaef3567bfa23ad4d114e348
      https://github.com/llvm/llvm-project/commit/5706639779ad17cfaaef3567bfa23ad4d114e348
  Author: ergawy <kareem.ergawy at gmail.com>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    M flang/lib/Lower/PFTBuilder.cpp

  Log Message:
  -----------
  [flang][NFC] Correct a stale comment on loop reclassification

Two places weaken the classification now, so calling this one "the one
place" is out of date.


Compare: https://github.com/llvm/llvm-project/compare/9657429183e0...5706639779ad

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