[all-commits] [llvm/llvm-project] 6c56a8: [clang][CodeGen] Generate follow-up metadata for l...

Ryotaro Kasuga via All-commits all-commits at lists.llvm.org
Thu Mar 27 04:30:00 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6c56a842b73cf2046b9ab8cf077890e11b758373
      https://github.com/llvm/llvm-project/commit/6c56a842b73cf2046b9ab8cf077890e11b758373
  Author: Ryotaro Kasuga <kasuga.ryotaro at fujitsu.com>
  Date:   2025-03-27 (Thu, 27 Mar 2025)

  Changed paths:
    M clang/lib/CodeGen/CGLoopInfo.cpp
    M clang/lib/CodeGen/CGLoopInfo.h
    M clang/test/CodeGenCXX/pragma-followup_inner.cpp
    M clang/test/CodeGenCXX/pragma-followup_outer.cpp
    M clang/test/CodeGenCXX/pragma-loop.cpp
    M llvm/test/Transforms/LoopVectorize/make-followup-loop-id.ll

  Log Message:
  -----------
  [clang][CodeGen] Generate follow-up metadata for loops in correct format  (#131985)

When pragma of loop transformations is specified, follow-up metadata for
loops is generated after each transformation. On the LLVM side,
follow-up metadata is expected to be a list of properties, such as the
following:

```
!followup = !{!"llvm.loop.vectorize.followup_all", !mp, !isvectorized}
!mp = !{!"llvm.loop.mustprogress"}
!isvectorized = !{"llvm.loop.isvectorized"}
```

However, on the clang side, the generated metadata contains an MDNode
that has those properties, as shown below:

```
!followup = !{!"llvm.loop.vectorize.followup_all", !loop_id}
!loop_id = distinct !{!loop_id, !mp, !isvectorized}
!mp = !{!"llvm.loop.mustprogress"}
!isvectorized = !{"llvm.loop.isvectorized"}
```
According to the
[LangRef](https://llvm.org/docs/TransformMetadata.html#transformation-metadata-structure),
the LLVM side is correct. Due to this inconsistency, follow-up metadata
was not interpreted correctly, e.g., only one transformation is applied
when multiple pragmas are used.

This patch fixes clang side to emit followup metadata in correct format.



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