[llvm] AMDGPU: Rewrite VGPR MFMAs to AGPR when directly copied to AGPR class (PR #152480)

Carl Ritson via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 8 01:05:22 PDT 2025


================
@@ -109,12 +109,17 @@ bool AMDGPURewriteAGPRCopyMFMAImpl::run(MachineFunction &MF) const {
 
     // Find AV_* registers assigned to AGPRs.
     const TargetRegisterClass *VirtRegRC = MRI.getRegClass(VReg);
-    if (!TRI.isVectorSuperClass(VirtRegRC))
+    if (!TRI.hasAGPRs(VirtRegRC))
       continue;
 
-    const TargetRegisterClass *AssignedRC = TRI.getPhysRegBaseClass(PhysReg);
-    if (!TRI.isAGPRClass(AssignedRC))
-      continue;
+    const TargetRegisterClass *AssignedRC = VirtRegRC;
----------------
perlfu wrote:

Doesn't ```AssignedRC``` always need to end up being the RC of ```PhysReg```?
Or is the code below that rewrites ```VReg``` RC to ```AssignedRC``` actually redundant?
(I suspect the later.)

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


More information about the llvm-commits mailing list