[llvm] [ARM] Replace uses of ARM::NoRegister with Register() or isValid() NFC (PR #224083)

David Green via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 19 02:04:21 PDT 2026


================
@@ -2122,18 +2122,18 @@ static void CMSEPushCalleeSaves(const TargetInstrInfo &TII,
     // memory, and allow us to later pop them with a single instructions.
     // FIXME: Could also use any of r0-r3 that are free (including in the
     // first PUSH above).
-    for (unsigned LoReg = ARM::R7, HiReg = ARM::R11; LoReg >= ARM::R4;
+    for (Register LoReg = ARM::R7, HiReg = ARM::R11; LoReg >= ARM::R4;
----------------
davemgreen wrote:

Lets remove at least this one, if it lets us remove the -- operator. Something like this maybe
```
    const Register LoRegs[] = {ARM::R7, ARM::R6, ARM::R5, ARM::R4};
    const Register HiRegs[] = {ARM::R11, ARM::R10, ARM::R9, ARM::R8};
    unsigned HiIdx = 0;
    for (Register LoReg : LoRegs) {
      if (JumpReg == LoReg)
        continue;
      BuildMI(MBB, MBBI, DL, TII.get(ARM::tMOVr), LoReg)
          .addReg(HiRegs[HiIdx],
                  getUndefRegState(!LiveRegs.contains(HiRegs[HiIdx])))
          .add(predOps(ARMCC::AL));
      ++HiIdx;
    }
```

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


More information about the llvm-commits mailing list