[llvm] [AMDGPU][GlobalISel] Guard against use of disallowed sub-registers (PR #188781)

Igor Wodiany via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 13 03:23:34 PDT 2026


================
@@ -730,8 +730,14 @@ bool AMDGPUInstructionSelector::selectG_UNMERGE_VALUES(MachineInstr &MI) const {
   ArrayRef<int16_t> SubRegs = TRI.getRegSplitParts(SrcRC, DstSize / 8);
   for (int I = 0, E = NumDst; I != E; ++I) {
     MachineOperand &Dst = MI.getOperand(I);
-    BuildMI(*BB, &MI, DL, TII.get(TargetOpcode::COPY), Dst.getReg())
-        .addReg(SrcReg, {}, SubRegs[I]);
+    // hi16:sreg_32 is not allowed so explicitly shift upper 16-bits.
+    if (SrcBank->getID() == AMDGPU::SGPRRegBankID && SubRegs[I] == AMDGPU::hi16)
----------------
IgWod wrote:

Fixed

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


More information about the llvm-commits mailing list