[llvm] [AMDGPU] HasOneUse uses (PR #92534)

via llvm-commits llvm-commits at lists.llvm.org
Fri May 17 08:44:58 PDT 2024


================
@@ -468,7 +468,23 @@ bool GIMatchTableExecutor::executeMatchTable(
         if (handleReject() == RejectAndGiveUp)
           return false;
       }
+      break;
+    }
+    case GIM_CheckHasOneUse: {
+      uint64_t InsnID = readULEB();
 
+      DEBUG_WITH_TYPE(TgtExecutor::getName(),
+                      dbgs() << CurrentIdx << ": GIM_CheckHasOneUse(MIs["
+                             << InsnID << "]\n");
+
+      const MachineInstr *MI = State.MIs[InsnID];
+      assert(MI && "Used insn before defined");
+      assert(MI->getNumDefs() > 0 && "No defs");
+      const Register Res = MI->getOperand(0).getReg();
+
+      if (!MRI.hasOneNonDBGUse(Res))
+        if (handleReject() == RejectAndGiveUp)
+          return false;
----------------
jofrn wrote:

```
if (!MRI.use_nodbg_empty(Res)) {
  if (handleReject() == RejectAndGiveUp)
    return false;
}
```
is how HasNoUse is implemented. Shouldn't we keep these styles the same?

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


More information about the llvm-commits mailing list