From d0dd24a381a7ee54cb42201889a0d4533b0f9ffa Mon Sep 17 00:00:00 2001 From: Matt Arsenault Date: Thu, 6 Feb 2020 08:34:18 -0500 Subject: [PATCH] AMDGPU/GlobalISel: Fix crashing on weird G_INSERT sources No test since these cases shouldn't really be getting through the legalizer. --- llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp index 7c4fd81..9e1fb42 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp @@ -737,7 +737,7 @@ bool AMDGPUInstructionSelector::selectG_INSERT(MachineInstr &I) const { // Deal with weird cases where the class only partially supports the subreg // index. Src0RC = TRI.getSubClassWithSubReg(Src0RC, SubReg); - if (!Src0RC) + if (!Src0RC || !Src1RC) return false; if (!RBI.constrainGenericRegister(DstReg, *DstRC, *MRI) || -- 2.7.4