[llvm] [RISCV] Replace uses of RISCV::NoRegister with Register(), isValid(), or operator bool. NFC (PR #161781)
Sam Elliott via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 2 23:54:17 PDT 2025
================
@@ -1560,7 +1560,7 @@ static MCRegister getRVVBaseRegister(const RISCVRegisterInfo &TRI,
MCRegister BaseReg = TRI.getSubReg(Reg, RISCV::sub_vrm1_0);
// If it's not a grouped vector register, it doesn't have subregister, so
// the base register is just itself.
- if (BaseReg == RISCV::NoRegister)
+ if (!BaseReg)
----------------
lenary wrote:
Quibble - MCRegister doesn't have an `operator bool`, you're using the `operator unsigned` here, and then assuming that NoRegister has falsey value - but using RISCV::NoRegister is a way to remove that assumption, or you could do the following:
```suggestion
if (!BaseReg.isValid())
```
https://github.com/llvm/llvm-project/pull/161781
More information about the llvm-commits
mailing list