[llvm] r343508 - [AMDGPU] Fixed SIInstrInfo::getOpSize to handle subregs
Stanislav Mekhanoshin via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 1 11:00:02 PDT 2018
Author: rampitec
Date: Mon Oct 1 11:00:02 2018
New Revision: 343508
URL: http://llvm.org/viewvc/llvm-project?rev=343508&view=rev
Log:
[AMDGPU] Fixed SIInstrInfo::getOpSize to handle subregs
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
Modified:
llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.h
Modified: llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.h?rev=343508&r1=343507&r2=343508&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.h (original)
+++ llvm/trunk/lib/Target/AMDGPU/SIInstrInfo.h Mon Oct 1 11:00:02 2018
@@ -730,6 +730,11 @@ public:
/// 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;
}
More information about the llvm-commits
mailing list