AMDGPU/SI: Fold operands with sub-registers
[oota-llvm.git] / lib / Target / AMDGPU / SIInstrInfo.cpp
index a08a5a8fed3612ab0c53868a9d3fc40be99caeaf..bd80756d5c8fb790a5aec60f0f80563313ac676b 100644 (file)
@@ -1777,6 +1777,10 @@ bool SIInstrInfo::isLegalRegOperand(const MachineRegisterInfo &MRI,
     MRI.getRegClass(Reg) :
     RI.getPhysRegClass(Reg);
 
+  const SIRegisterInfo *TRI =
+      static_cast<const SIRegisterInfo*>(MRI.getTargetRegisterInfo());
+  RC = TRI->getSubRegClass(RC, MO.getSubReg());
+
   // In order to be legal, the common sub-class must be equal to the
   // class of the current operand.  For example:
   //