[llvm] r326487 - AMDGPU/GlobalISel: Remove default register mapping

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 1 13:20:44 PST 2018


Author: arsenm
Date: Thu Mar  1 13:20:44 2018
New Revision: 326487

URL: http://llvm.org/viewvc/llvm-project?rev=326487&view=rev
Log:
AMDGPU/GlobalISel: Remove default register mapping

This crashes for some opcodes, which prevents the SelectionDAG
fallback from working.

Patch by Tom Stellard

Modified:
    llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp

Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp?rev=326487&r1=326486&r2=326487&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp Thu Mar  1 13:20:44 2018
@@ -228,10 +228,9 @@ AMDGPURegisterBankInfo::getInstrMapping(
   const MachineRegisterInfo &MRI = MF.getRegInfo();
   SmallVector<const ValueMapping*, 8> OpdsMapping(MI.getNumOperands());
 
-  bool IsComplete = true;
   switch (MI.getOpcode()) {
   default:
-    IsComplete = false;
+    return getInvalidInstructionMapping();
     break;
   case AMDGPU::G_IMPLICIT_DEF: {
     unsigned Size = MRI.getType(MI.getOperand(0).getReg()).getSizeInBits();
@@ -328,20 +327,6 @@ AMDGPURegisterBankInfo::getInstrMapping(
     return getInstrMappingForLoad(MI);
   }
 
-  if (!IsComplete) {
-    unsigned BankID = AMDGPU::SGPRRegBankID;
-
-    unsigned Size = 0;
-    for (unsigned Idx = 0; Idx < MI.getNumOperands(); ++Idx) {
-      // If the operand is not a register default to the size of the previous
-      // operand.
-      // FIXME: Can't we pull the types from the MachineInstr rather than the
-      // operands.
-      if (MI.getOperand(Idx).isReg())
-        Size = getSizeInBits(MI.getOperand(Idx).getReg(), MRI, *TRI);
-      OpdsMapping.push_back(AMDGPU::getValueMapping(BankID, Size));
-    }
-  }
   return getInstructionMapping(1, 1, getOperandsMapping(OpdsMapping),
                                MI.getNumOperands());
 }




More information about the llvm-commits mailing list