[llvm] [DebugInfo][NVPTX] Adding support for `inlined_at` debug directive in NVPTX backend (PR #170239)

Laxman Sole via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 9 16:47:12 PST 2025


laxmansole wrote:

> > > I'm a bit confused by the implementation - at the start of the function, it scans for every inlined at location, then it checks if a given location has been found in that list and if it has, it emits it - but then removes these from the list?
> > > It's possible for an inlinedAt location to appear more than once - it gets inlined, then some other code gets hoisted or sunk into the middle of the inlined location - what's meant to happen there?
> > 
> > 
> > inlinedAt locations are added to the `DenseSet` to avoid emitting the same location multiple times, like the following `.locs` in this example. `.loc 1 31 5 // test.cu:31:5` `.loc 1 25 4, function_name $L__info_string0, inlined_at 1 31 5 // test.cu:25:4 `
> 
> Sorry, I'm still not quite following here - what would the output look like in this ^ example if the DenseSet weren't used?
> 
[test.after.txt](https://github.com/user-attachments/files/24066076/test.after.txt)
[test.No_DenseSet.txt](https://github.com/user-attachments/files/24066077/test.No_DenseSet.txt)
Here's the output difference if DenseSet is not use-
<img width="1375" height="880" alt="image" src="https://github.com/user-attachments/assets/99d9a20c-a390-4c15-9b17-b5d588aaddbf" />

> That seems like a better approach to addressing that problem than having to add a new data structure/memory usage/extra scanning pass/etc.

Let me refactor the code and remove the scanning pass. I believe we can just keep track of already emitted locs.



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


More information about the llvm-commits mailing list