[all-commits] [llvm/llvm-project] f486cc: [flang] Add loop annotation attributes to the loop...

Asher Mancinelli via All-commits all-commits at lists.llvm.org
Wed May 14 07:08:19 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f486cc4417059e47e5b6e18294bbacd767c04030
      https://github.com/llvm/llvm-project/commit/f486cc4417059e47e5b6e18294bbacd767c04030
  Author: Asher Mancinelli <ashermancinelli at gmail.com>
  Date:   2025-05-14 (Wed, 14 May 2025)

  Changed paths:
    M flang/lib/Optimizer/Transforms/ControlFlowConverter.cpp
    M flang/test/Fir/vector-always.fir
    M flang/test/Integration/unroll.f90
    M flang/test/Integration/unroll_and_jam.f90
    M flang/test/Integration/vector-always.f90

  Log Message:
  -----------
  [flang] Add loop annotation attributes to the loop backedge (#126082)

Flang currently adds loop metadata to a conditional branch in the loop
preheader, while clang adds it to the loop latch's branch instruction.
Langref says:

> Currently, loop metadata is implemented as metadata attached to the
branch instruction in the loop latch block.
>
> https://llvm.org/docs/LangRef.html#llvm-loop

I misread langref a couple times, but I think this is the appropriate
branch op for the LoopAnnotationAttr. In a couple examples I found that
the metadata was lost entirely during canonicalization. This patch makes
the codegen look more like clang's and the annotations persist through
codegen.

* current clang: https://godbolt.org/z/8WhbcrnG3
* current flang: https://godbolt.org/z/TrPboqqcn



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