[llvm] d0dd24a - AMDGPU/GlobalISel: Fix crashing on weird G_INSERT sources

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 30 15:14:14 PDT 2020


Author: Matt Arsenault
Date: 2020-03-30T18:14:04-04:00
New Revision: d0dd24a381a7ee54cb42201889a0d4533b0f9ffa

URL: https://github.com/llvm/llvm-project/commit/d0dd24a381a7ee54cb42201889a0d4533b0f9ffa
DIFF: https://github.com/llvm/llvm-project/commit/d0dd24a381a7ee54cb42201889a0d4533b0f9ffa.diff

LOG: AMDGPU/GlobalISel: Fix crashing on weird G_INSERT sources

No test since these cases shouldn't really be getting through the
legalizer.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp b/llvm/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp
index 7c4fd8124e7e..9e1fb426116b 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) ||


        


More information about the llvm-commits mailing list