AMDGPU/GlobalISel: Fix crashing on weird G_INSERT sources
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Thu, 6 Feb 2020 13:34:18 +0000 (08:34 -0500)
committerMatt Arsenault <arsenm2@gmail.com>
Mon, 30 Mar 2020 22:14:04 +0000 (18:14 -0400)
No test since these cases shouldn't really be getting through the
legalizer.

llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp

index 7c4fd81..9e1fb42 100644 (file)
@@ -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) ||