Currently it returns incorrect operand size for a target independet
node such as COPY if operand is a register with subreg. Instead of
correct subreg size it returns a size of the whole superreg.
Differential Revision: https://reviews.llvm.org/D52736
llvm-svn: 343508
/// This form should usually be preferred since it handles operands
/// with unknown register classes.
unsigned getOpSize(const MachineInstr &MI, unsigned OpNo) const {
+ const MachineOperand &MO = MI.getOperand(OpNo);
+ if (MO.isReg()) {
+ if (unsigned SubReg = MO.getSubReg())
+ return RI.getSubRegIndexLaneMask(SubReg).getNumLanes() * 4;
+ }
return RI.getRegSizeInBits(*getOpRegClass(MI, OpNo)) / 8;
}