Index: llvm/lib/Target/AMDGPU/GCNNSAReassign.cpp =================================================================== --- llvm/lib/Target/AMDGPU/GCNNSAReassign.cpp +++ llvm/lib/Target/AMDGPU/GCNNSAReassign.cpp @@ -190,6 +190,12 @@ if (MRI->getRegClass(Reg) != &AMDGPU::VGPR_32RegClass || Op.getSubReg()) return NSA_Status::FIXED; + // InlineSpiller does not call LRM::assign() after an LI split leaving + // it in an incosistent state, so we cannot call LRM::unassign(). + // Skip reassign if a register has originated from such split. + if (VRM->getPreSplitReg(Reg)) + return NSA_Status::FIXED; + const MachineInstr *Def = MRI->getUniqueVRegDef(Reg); if (Def && Def->isCopy() && Def->getOperand(1).getReg() == PhysReg) Index: llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp =================================================================== --- llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp +++ llvm/lib/Target/AMDGPU/GCNRegBankReassign.cpp @@ -471,6 +471,12 @@ if (Reg.isPhysical() || !VRM->isAssignedReg(Reg)) return false; + // InlineSpiller does not call LRM::assign() after an LI split leaving it + // in an incosistent state, so we cannot call LRM::unassign(). Skip reassign + // if a register has originated from such split. + if (VRM->getPreSplitReg(Reg)) + return false; + const MachineInstr *Def = MRI->getUniqueVRegDef(Reg); Register PhysReg = VRM->getPhys(Reg);