[AMDGPU][NFC] Avoid copying MachineOperands (#166293)
Avoid copying machine operands. Signed-off-by: John Lu <John.Lu@amd.com>
This commit is contained in:
parent
044e0f041d
commit
87b1d3537a
@ -6764,7 +6764,7 @@ bool AMDGPUInstructionSelector::selectSGetBarrierState(
|
||||
MachineInstr &I, Intrinsic::ID IntrID) const {
|
||||
MachineBasicBlock *MBB = I.getParent();
|
||||
const DebugLoc &DL = I.getDebugLoc();
|
||||
MachineOperand BarOp = I.getOperand(2);
|
||||
const MachineOperand &BarOp = I.getOperand(2);
|
||||
std::optional<int64_t> BarValImm =
|
||||
getIConstantVRegSExtVal(BarOp.getReg(), *MRI);
|
||||
|
||||
@ -6817,8 +6817,8 @@ bool AMDGPUInstructionSelector::selectNamedBarrierInit(
|
||||
MachineInstr &I, Intrinsic::ID IntrID) const {
|
||||
MachineBasicBlock *MBB = I.getParent();
|
||||
const DebugLoc &DL = I.getDebugLoc();
|
||||
MachineOperand BarOp = I.getOperand(1);
|
||||
MachineOperand CntOp = I.getOperand(2);
|
||||
const MachineOperand &BarOp = I.getOperand(1);
|
||||
const MachineOperand &CntOp = I.getOperand(2);
|
||||
|
||||
// BarID = (BarOp >> 4) & 0x3F
|
||||
Register TmpReg0 = MRI->createVirtualRegister(&AMDGPU::SReg_32RegClass);
|
||||
|
||||
@ -136,7 +136,7 @@ bool GCNPreRAOptimizationsImpl::processReg(Register Reg) {
|
||||
continue;
|
||||
|
||||
if (Def.getOpcode() == AMDGPU::V_ACCVGPR_WRITE_B32_e64) {
|
||||
MachineOperand DefSrcMO = Def.getOperand(1);
|
||||
const MachineOperand &DefSrcMO = Def.getOperand(1);
|
||||
|
||||
// Immediates are not an issue and can be propagated in
|
||||
// postrapseudos pass. Only handle cases where defining
|
||||
|
||||
@ -7945,7 +7945,7 @@ void SIInstrInfo::moveToVALUImpl(SIInstrWorklist &Worklist,
|
||||
}
|
||||
legalizeOperands(*NewInstr, MDT);
|
||||
int SCCIdx = Inst.findRegisterDefOperandIdx(AMDGPU::SCC, /*TRI=*/nullptr);
|
||||
MachineOperand SCCOp = Inst.getOperand(SCCIdx);
|
||||
const MachineOperand &SCCOp = Inst.getOperand(SCCIdx);
|
||||
addSCCDefUsersToVALUWorklist(SCCOp, Inst, Worklist, CondReg);
|
||||
Inst.eraseFromParent();
|
||||
return;
|
||||
@ -7985,7 +7985,7 @@ void SIInstrInfo::moveToVALUImpl(SIInstrWorklist &Worklist,
|
||||
legalizeOperandsVALUt16(*NewInstr, MRI);
|
||||
legalizeOperands(*NewInstr, MDT);
|
||||
int SCCIdx = Inst.findRegisterDefOperandIdx(AMDGPU::SCC, /*TRI=*/nullptr);
|
||||
MachineOperand SCCOp = Inst.getOperand(SCCIdx);
|
||||
const MachineOperand &SCCOp = Inst.getOperand(SCCIdx);
|
||||
addSCCDefUsersToVALUWorklist(SCCOp, Inst, Worklist, CondReg);
|
||||
Inst.eraseFromParent();
|
||||
return;
|
||||
@ -8183,7 +8183,7 @@ void SIInstrInfo::moveToVALUImpl(SIInstrWorklist &Worklist,
|
||||
AMDGPU::OpName::src0_modifiers) >= 0)
|
||||
NewInstr.addImm(0);
|
||||
if (AMDGPU::hasNamedOperand(NewOpcode, AMDGPU::OpName::src0)) {
|
||||
MachineOperand Src = Inst.getOperand(1);
|
||||
const MachineOperand &Src = Inst.getOperand(1);
|
||||
NewInstr->addOperand(Src);
|
||||
}
|
||||
|
||||
@ -9199,7 +9199,7 @@ void SIInstrInfo::movePackToVALU(SIInstrWorklist &Worklist,
|
||||
addUsersToMoveToVALUWorklist(ResultReg, MRI, Worklist);
|
||||
}
|
||||
|
||||
void SIInstrInfo::addSCCDefUsersToVALUWorklist(MachineOperand &Op,
|
||||
void SIInstrInfo::addSCCDefUsersToVALUWorklist(const MachineOperand &Op,
|
||||
MachineInstr &SCCDefInst,
|
||||
SIInstrWorklist &Worklist,
|
||||
Register NewCond) const {
|
||||
|
||||
@ -172,7 +172,7 @@ private:
|
||||
void addUsersToMoveToVALUWorklist(Register Reg, MachineRegisterInfo &MRI,
|
||||
SIInstrWorklist &Worklist) const;
|
||||
|
||||
void addSCCDefUsersToVALUWorklist(MachineOperand &Op,
|
||||
void addSCCDefUsersToVALUWorklist(const MachineOperand &Op,
|
||||
MachineInstr &SCCDefInst,
|
||||
SIInstrWorklist &Worklist,
|
||||
Register NewCond = Register()) const;
|
||||
|
||||
@ -640,7 +640,7 @@ void SIPreEmitPeephole::collectUnpackingCandidates(
|
||||
}
|
||||
|
||||
void SIPreEmitPeephole::performF32Unpacking(MachineInstr &I) {
|
||||
MachineOperand DstOp = I.getOperand(0);
|
||||
const MachineOperand &DstOp = I.getOperand(0);
|
||||
|
||||
uint16_t UnpackedOpcode = mapToUnpackedOpcode(I);
|
||||
assert(UnpackedOpcode != std::numeric_limits<uint16_t>::max() &&
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user