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

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 25 03:46:28 PDT 2025


https://github.com/Meinersbur approved this pull request.

I have never considered loop properties to be recursive. Recursive MDNodes cannot be uniqued[^1] and hence I would avoid creating them. Clang does not create them. I would not require handling those in this PR, it can be fixed when there is a use case for such metadata. But a TODO comment could be helpful for anyone encountering an endless recursion here. If you decide to add handling for such nodes, be sure to add a test case since otherwise it will bitrot.

[^1]: This is why loop metadata has a recursive first element, it was meant to be a "LoopID" before MDNode supported `distinct`. Yet, it cannot be used as an identifier for a specific loop because various passes (e.g inline) clone entire loops without creating a new "LoopID" for each new loop. I'd rather understand it as a bag of properties.

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


More information about the llvm-commits mailing list