[llvm] [AMDGPU][GlobalISel] Guard against use of disallowed sub-registers (PR #188781)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 10 11:49:52 PDT 2026
================
@@ -243,13 +243,15 @@ bool InstructionSelect::selectMachineFunction(MachineFunction &MF) {
continue;
Register SrcReg = MI.getOperand(1).getReg();
Register DstReg = MI.getOperand(0).getReg();
- if (SrcReg.isVirtual() && DstReg.isVirtual()) {
- auto SrcRC = MRI.getRegClass(SrcReg);
- auto DstRC = MRI.getRegClass(DstReg);
- if (SrcRC == DstRC) {
- MRI.replaceRegWith(DstReg, SrcReg);
- MI.eraseFromParent();
- }
+ unsigned SrcSubIdx = MI.getOperand(1).getSubReg();
----------------
arsenm wrote:
Yes, you should be able to find a compatible subclass between SrcReg and DstReg that supports SrcSubReg
https://github.com/llvm/llvm-project/pull/188781
More information about the llvm-commits
mailing list