https://github.com/jayfoad approved this pull request. Code looks fine thanks. I suggest changing the title to something like "Fix non-deterministic iteration order in SIFixSGPRCopies" since you're not fixinf anything in DenseSet itself. https://github.com/llvm/llvm-project/pull/66617