Skip to content

Conversation

arsenm
Copy link
Contributor

@arsenm arsenm commented Sep 17, 2025

We need to account for local instruction constraints after
finding a replacement VGPR class. This solves expensive_checks
failures in existing tests.

We need to account for local instruction constraints after
finding a replacement VGPR class. This solves expensive_checks
failures in existing tests.
Copy link
Contributor Author

arsenm commented Sep 17, 2025

@arsenm arsenm marked this pull request as ready for review September 17, 2025 14:23
@llvmbot
Copy link
Member

llvmbot commented Sep 17, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: Matt Arsenault (arsenm)

Changes

We need to account for local instruction constraints after
finding a replacement VGPR class. This solves expensive_checks
failures in existing tests.


Full diff: https://github.com/llvm/llvm-project/pull/159369.diff

1 Files Affected:

  • (modified) llvm/lib/Target/AMDGPU/SIInstrInfo.cpp (+4-1)
diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index c39da779ecf8c..37c75fe7f7dfd 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -8993,7 +8993,10 @@ void SIInstrInfo::addUsersToMoveToVALUWorklist(
       break;
     }
 
-    if (!RI.hasVectorRegisters(getOpRegClass(UseMI, OpNo)))
+    const TargetRegisterClass *OpRC = getOpRegClass(UseMI, OpNo);
+    MRI.constrainRegClass(DstReg, OpRC);
+
+    if (!RI.hasVectorRegisters(OpRC))
       Worklist.insert(&UseMI);
     else
       // Legalization could change user list.

@arsenm arsenm merged commit d57aa48 into main Sep 17, 2025
13 checks passed
@arsenm arsenm deleted the users/arsenm/amdgpu/constrain-reg-class-moveToVALU branch September 17, 2025 22:36
kimsh02 pushed a commit to kimsh02/llvm-project that referenced this pull request Sep 19, 2025
SeongjaeP pushed a commit to SeongjaeP/llvm-project that referenced this pull request Sep 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants