[llvm] [DebugInfo] Handle followup loop metadata in updateLoopMetadataDebugLocations (PR #157557)

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 24 07:19:31 PDT 2025


bjope wrote:

> One small question - is a "visited" list necessary to avoid updating the same metadata multiple times? It might not be an issue, or even something that already happens, but it does seem more likely that we could end up updating the same DILocation multiple times from your example.

We may end up finding same DILocation multiple times, but that could happen also without the recursion. And I think we are expected to use the Updater callback for each.

I guess there could be a problem if there are self-references/cycles in the followup tuples, such as:
```
!11 = !{!"llvm.loop.distribute.followup_all", !7, !8, !9, !12, !13, !11}
```
or
```
!11 = !{!"llvm.loop.distribute.followup_all", !7, !8, !9, !12, !13, !14}
!14 = !{!"llvm.loop.vectorize.followup_all", !7, !8, !9, !15, !16, !11}
```
I wonder if that is supported. And also not quite sure how to deal with it. We could perhaps detect it and use and assert instead of infinite recursion. Getting complicated if we want to track and fixup such cycles based on if there were any "Updates" or not.

https://github.com/llvm/llvm-project/pull/157557


More information about the llvm-commits mailing list