[llvm] [AMDGPU][SIInsertWaitCnts] Use RegUnits-based tracking (PR #162077)

Pierre van Houtryve via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 28 04:02:56 PST 2025


Pierre-vh wrote:

> One more thought: is there a risk of the DenseMaps growing ever larger because we never remove entries from them? Maybe the merge function would be a good opportunity to purge useless entries?

I added a method to purge the map, and I also made `clearVgprVmemTypes` erase the map entry if it causes it to be empty.

The map can't grow huge in an uncontrolled way. The worst case (if we don't purge it) is that we end up with one entry for each register unit used across the function in every `WaitcntBracket` instance. 

I collected statistics locally using an assert in the destructor of `WaitcntBrackets`, and the worst I saw was about 122 VMem map entries that were empty (before implementing the fixes, now it's zero).
Should I add the assert back in ? It may be useful to prevent accidental mis-use of the map

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


More information about the llvm-commits mailing list