Skip to content

Commit e020fc1

Browse files
authored
[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.
1 parent 28b300d commit e020fc1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

llvm/test/TableGen/HasNoUse.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def NO_RET_ATOMIC_ADD : I<(outs), (ins GPR32Op:$src0, GPR32Op:$src1), []>;
1313
// SDAG-NEXT: SDNode *N = Node;
1414
// SDAG-NEXT: (void)N;
1515
// SDAG-NEXT: if (cast<MemSDNode>(N)->getMemoryVT() != MVT::i32) return false;
16-
// SDAG-NEXT: if (!SDValue(N, 0).use_empty()) return false;
16+
// SDAG-NEXT: if (N->hasAnyUseOfValue(0)) return false;
1717
// SDAG-NEXT: return true;
1818

1919
// GISEL: GIM_CheckOpcode, /*MI*/0, GIMT_Encode2(TargetOpcode::G_ATOMICRMW_ADD),

llvm/test/TableGen/predicate-patfags.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def TGTmul24_oneuse : PatFrag<
5252
// SDAG: OPC_CheckPredicate0, // Predicate_TGTmul24_oneuse
5353

5454
// SCUSTOM: return N->hasOneUse();
55-
// SBUILTIN: if (!SDValue(N, 0).hasOneUse()) return false;
55+
// SBUILTIN: if (!N->hasNUsesOfValue(1, 0)) return false;
5656

5757
// GISEL: GIM_CheckOpcode, /*MI*/1, GIMT_Encode2(TargetOpcode::G_INTRINSIC_W_SIDE_EFFECTS),
5858
// GISEL: GIM_CheckIntrinsicID, /*MI*/1, /*Op*/1, GIMT_Encode2(Intrinsic::tgt_mul24),

llvm/utils/TableGen/Common/CodeGenDAGPatterns.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,9 +1127,9 @@ std::string TreePredicateFn::getPredCode() const {
11271127
}
11281128

11291129
if (hasNoUse())
1130-
Code += "if (!SDValue(N, 0).use_empty()) return false;\n";
1130+
Code += "if (N->hasAnyUseOfValue(0)) return false;\n";
11311131
if (hasOneUse())
1132-
Code += "if (!SDValue(N, 0).hasOneUse()) return false;\n";
1132+
Code += "if (!N->hasNUsesOfValue(1, 0)) return false;\n";
11331133

11341134
std::string PredicateCode =
11351135
std::string(PatFragRec->getRecord()->getValueAsString("PredicateCode"));

0 commit comments

Comments
 (0)