[llvm] [RISCV] Don't call use_nodbg_operands for physical registers in RISCVOptWInstrs hasAllNBitUsers. (PR #77032)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 17:51:48 PST 2024


================
@@ -126,6 +126,9 @@ static bool hasAllNBitUsers(const MachineInstr &OrigMI,
     if (MI->getNumExplicitDefs() != 1)
       return false;
 
+    if (!MI->getOperand(0).getReg().isVirtual())
+      return false;
+
     for (auto &UserOp : MRI.use_nodbg_operands(MI->getOperand(0).getReg())) {
----------------
mshockwave wrote:

nit: can we factor out `MI->getOperand(0).getReg()` into its own variable?

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


More information about the llvm-commits mailing list