[llvm] [TableGen] HasOneUse builtin predicate on PatFrags (PR #91578)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Mon May 13 01:33:05 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;
----------------
Pierre-vh wrote:
```suggestion
if (!MRI.hasOneNonDBGUse(Res)) {
if (handleReject() == RejectAndGiveUp)
return false;
}
```
https://github.com/llvm/llvm-project/pull/91578
More information about the llvm-commits
mailing list