[llvm] [AMDGPU] In instruction selector, allow copy from physical reg to s1 (PR #96157)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 14 09:52:04 PDT 2024


arsenm wrote:

> In the new commit I created a separate function just to handle copy from physical reg to VCC. However, I'm not sure this is an improvement over the previous version. Modifying the existing `isVCC()` would be more messy. 

There can be 2 variants of isVCC.



> One particular problem is that the check could have 3 different results: (1) it's not a copy to VCC we are looking for (2) it's a valid phy to VCC copy (3) it's not a valid phy to VCC copy.

The results are is a boolean / VCC / wave mask copy, or is not. 

> 
> If the main concern about the previous version is that `getRegClassOrNull()` is called after the reg class is already obtained in `isVCC()`, then maybe we can add an additional parameter to `isVCC()` to return the reg class.

You've added a completely new path, and left the old handling. The new version should rely on fixed isVCC checks using the type hint. You should not have to query whether a register belongs to a register class, only query what that register's class is. 




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


More information about the llvm-commits mailing list