[TableGen] Directly use SDNode functions to implement HasOneUse and HasNoUse. NFC (#133976)

The SDValue functions we were calling wrap SDNode functions we can call
directly.
This commit is contained in:
Craig Topper 2025-04-01 22:14:17 -07:00 committed by GitHub
parent 28b300d546
commit e020fc1895
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 4 additions and 4 deletions

View File

@ -13,7 +13,7 @@ def NO_RET_ATOMIC_ADD : I<(outs), (ins GPR32Op:$src0, GPR32Op:$src1), []>;
// SDAG-NEXT: SDNode *N = Node;
// SDAG-NEXT: (void)N;
// SDAG-NEXT: if (cast<MemSDNode>(N)->getMemoryVT() != MVT::i32) return false;
// SDAG-NEXT: if (!SDValue(N, 0).use_empty()) return false;
// SDAG-NEXT: if (N->hasAnyUseOfValue(0)) return false;
// SDAG-NEXT: return true;
// GISEL: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_ATOMICRMW_ADD),

View File

@ -52,7 +52,7 @@ def TGTmul24_oneuse : PatFrag<
// SDAG: OPC_CheckPredicate0, // Predicate_TGTmul24_oneuse
// SCUSTOM: return N->hasOneUse();
// SBUILTIN: if (!SDValue(N, 0).hasOneUse()) return false;
// SBUILTIN: if (!N->hasNUsesOfValue(1, 0)) return false;
// GISEL: GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS),
// GISEL: GIM_CheckIntrinsicID, /*MI*/1, /*Op*/1, GIMT_Encode2(Intrinsic::tgt_mul24),

View File

@ -1127,9 +1127,9 @@ std::string TreePredicateFn::getPredCode() const {
}
if (hasNoUse())
Code += "if (!SDValue(N, 0).use_empty()) return false;\n";
Code += "if (N->hasAnyUseOfValue(0)) return false;\n";
if (hasOneUse())
Code += "if (!SDValue(N, 0).hasOneUse()) return false;\n";
Code += "if (!N->hasNUsesOfValue(1, 0)) return false;\n";
std::string PredicateCode =
std::string(PatFragRec->getRecord()->getValueAsString("PredicateCode"));