[llvm] [AMDGPU] Fix VGPR to SGPR copy for inline asm with SGPR constraint (PR #176330)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 08:25:05 PST 2026


arsenm wrote:

> > > It would probably be more reliable to handle this by forcibly inserting readfirstlane on inline asm SGPR inputs and let it be cleaned up later, like how return-in-sgpr is handled
> > 
> > 
> > With this approach there should be 0 changes to SIFixSGPRCopies
> 
> Hey Matt, are you suggesting implementing a method to lower inline-asm in SISelLowering.cpp , 

The inline assembly is lowered there. But yes, this should be fully encapsulated in the asm handling.

> Also one more question, Do you want me to try adding a waterfall approach for divergent cases as well? That seemed complicated to add.

No, this probably shouldn't waterfall. Inline assembly is impossible to handle correctly in these cases. Depending on the content of the asm, which you do not know, either readfirstlane or waterfall could be incorrect. For inline asm we just resolve this to readfirstlane. The common case is special m0 inputs for which there is no choice 

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


More information about the llvm-commits mailing list