[llvm] [AMDGPU] Flatten recursive register resource info propagation (PR #142766)

Scott Linder via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 5 10:54:10 PDT 2025


slinder1 wrote:

> That'd be the way to go if we'd have all functions' resource info at the time of printing but with the resource info only known for the current function being processed, it's a lot harder to do something along these lines at this point in processing (at least, as far as I'm aware). Changing the resource usage info pass to a module pass for gathering resource usage for all functions is what caused issues with the pass pipeline, so also a tough sell as well for an approach. I could cache the already processed/printed functions and use that for recursion to determine resource info for functions within said recursion but I think it'd be much of the same as I have right now, just less traversing MCExprs.
> 
> However, I may be missing something so please do let me know if there's an (obvious) approach available here.
> 
> Thanks

Makes sense, and I didn't actually think too hard on whether the repeated work has a high enough constant factor to really matter here, I was just a bit concerned about some potential pathological case where the expression walking ends up actually taking wall time. It may be that the dataflow or Jay's SCC approaches are a net negative in simpler cases, and those seem much more common.

The change LGTM otherwise, but I'll give others a chance to look over it too.

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


More information about the llvm-commits mailing list