[llvm] [RegAllocFast] NFC cleanups (PR #74860)

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 10:07:04 PST 2023


================
@@ -1241,21 +1250,14 @@ void RegAllocFast::allocateInstruction(MachineInstr &MI) {
   RegMasks.clear();
   BundleVirtRegsMap.clear();
 
-  auto TiedOpIsUndef = [&](const MachineOperand &MO, unsigned Idx) {
-    assert(MO.isTied());
-    unsigned TiedIdx = MI.findTiedOperandIdx(Idx);
-    const MachineOperand &TiedMO = MI.getOperand(TiedIdx);
-    return TiedMO.isUndef();
-  };
   // Scan for special cases; Apply pre-assigned register defs to state.
   bool HasPhysRegUse = false;
   bool HasRegMask = false;
   bool HasVRegDef = false;
   bool HasDef = false;
   bool HasEarlyClobber = false;
   bool NeedToAssignLiveThroughs = false;
-  for (unsigned I = 0; I < MI.getNumOperands(); ++I) {
-    MachineOperand &MO = MI.getOperand(I);
+  for (MachineOperand &MO : MI.operands()) {
----------------
nickdesaulniers wrote:

It was done to pass `I` to `TiedOpIsUndef`, not because `MI`'s number of operands change in the loop. I've eliminated the need to pass `I`, since it can be rematerialized from the `MachineOperand` itself.

https://github.com/llvm/llvm-project/pull/74860


More information about the llvm-commits mailing list