7 changes: 3 additions & 4 deletions llvm/lib/Target/ARC/ARCOptAddrMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ static bool dominatesAllUsesOf(const MachineInstr *MI, unsigned VReg,

assert(Register::isVirtualRegister(VReg) && "Expected virtual register!");

for (auto it = MRI->use_nodbg_begin(VReg), end = MRI->use_nodbg_end();
it != end; ++it) {
MachineInstr *User = it->getParent();
for (const MachineOperand &Use : MRI->use_nodbg_operands(VReg)) {
const MachineInstr *User = Use.getParent();
if (User->isPHI()) {
unsigned BBOperandIdx = User->getOperandNo(&*it) + 1;
unsigned BBOperandIdx = Use.getOperandNo() + 1;
MachineBasicBlock *MBB = User->getOperand(BBOperandIdx).getMBB();
if (MBB->empty()) {
const MachineBasicBlock *InstBB = MI->getParent();
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -907,7 +907,7 @@ static bool producesFalseLanesZero(MachineInstr &MI,
continue;
// Skip the lr predicate reg
int PIdx = llvm::findFirstVPTPredOperandIdx(MI);
if (PIdx != -1 && (int)MI.getOperandNo(&MO) == PIdx + 2)
if (PIdx != -1 && (int)MO.getOperandNo() == PIdx + 2)
continue;

// Check that this instruction will produce zeros in its false lanes:
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/M68k/M68kInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ bool M68kInstrInfo::isPCRelRegisterOperandLegal(
const MachineInstr *MI = MO.getParent();
const unsigned NameIndices = M68kInstrNameIndices[MI->getOpcode()];
StringRef InstrName(&M68kInstrNameData[NameIndices]);
const unsigned OperandNo = MI->getOperandNo(&MO);
const unsigned OperandNo = MO.getOperandNo();

// If this machine operand is the 2nd operand, then check
// whether the instruction has destination addressing mode 'k'.
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2563,7 +2563,7 @@ bool RISCVInstrInfo::hasAllNBitUsers(const MachineInstr &OrigMI,

for (auto &UserOp : MRI.use_operands(MI->getOperand(0).getReg())) {
const MachineInstr *UserMI = UserOp.getParent();
unsigned OpIdx = UserMI->getOperandNo(&UserOp);
unsigned OpIdx = UserOp.getOperandNo();

switch (UserMI->getOpcode()) {
default:
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVRegisterInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ bool RISCVRegisterInfo::getRegAllocationHints(

for (auto &MO : MRI->reg_nodbg_operands(VirtReg)) {
const MachineInstr &MI = *MO.getParent();
unsigned OpIdx = MI.getOperandNo(&MO);
unsigned OpIdx = MO.getOperandNo();
bool NeedGPRC;
if (isCompressible(MI, NeedGPRC)) {
if (OpIdx == 0 && MI.getOperand(1).isReg()) {
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) {
unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg);
// If this register operand is tied to another operand, we can't
// change it to an immediate. Untie it first.
MI.untieRegOperand(MI.getOperandNo(&MO));
MI.untieRegOperand(MO.getOperandNo());
MO.ChangeToImmediate(LocalId);
continue;
}
Expand All @@ -369,7 +369,7 @@ bool WebAssemblyExplicitLocals::runOnMachineFunction(MachineFunction &MF) {
if (MI.isInlineAsm()) {
unsigned LocalId = getLocalId(Reg2Local, MFI, CurLocal, OldReg);
// Untie it first if this reg operand is tied to another operand.
MI.untieRegOperand(MI.getOperandNo(&MO));
MI.untieRegOperand(MO.getOperandNo());
MO.ChangeToImmediate(LocalId);
continue;
}
Expand Down