Skip to content

Commit 3aa24ea

Browse files
authored
[SelectionDAG] Simplify classof of MemSDNode and MemIntrinsicSDNode (NFC) (#115720)
`SDNodeBits.IsMemIntrinsic` is set if and only if the node is an instance of `MemIntrinsicSDNode`. Thus, to check if a node is an instance of `MemIntrinsicSDNode` we only need to check this bit.
1 parent b4339dd commit 3aa24ea

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -708,15 +708,7 @@ END_TWO_BYTE_PACK()
708708
bool isUndef() const { return NodeType == ISD::UNDEF; }
709709

710710
/// Test if this node is a memory intrinsic (with valid pointer information).
711-
/// INTRINSIC_W_CHAIN and INTRINSIC_VOID nodes are sometimes created for
712-
/// non-memory intrinsics (with chains) that are not really instances of
713-
/// MemSDNode. For such nodes, we need some extra state to determine the
714-
/// proper classof relationship.
715-
bool isMemIntrinsic() const {
716-
return (NodeType == ISD::INTRINSIC_W_CHAIN ||
717-
NodeType == ISD::INTRINSIC_VOID) &&
718-
SDNodeBits.IsMemIntrinsic;
719-
}
711+
bool isMemIntrinsic() const { return SDNodeBits.IsMemIntrinsic; }
720712

721713
/// Test if this node is a strict floating point pseudo-op.
722714
bool isStrictFPOpcode() {
@@ -1464,7 +1456,6 @@ class MemSDNode : public SDNode {
14641456
switch (N->getOpcode()) {
14651457
case ISD::LOAD:
14661458
case ISD::STORE:
1467-
case ISD::PREFETCH:
14681459
case ISD::ATOMIC_CMP_SWAP:
14691460
case ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS:
14701461
case ISD::ATOMIC_SWAP:
@@ -1504,7 +1495,7 @@ class MemSDNode : public SDNode {
15041495
case ISD::EXPERIMENTAL_VECTOR_HISTOGRAM:
15051496
return true;
15061497
default:
1507-
return N->isMemIntrinsic() || N->isTargetMemoryOpcode();
1498+
return N->isMemIntrinsic();
15081499
}
15091500
}
15101501
};
@@ -1596,9 +1587,7 @@ class MemIntrinsicSDNode : public MemSDNode {
15961587
static bool classof(const SDNode *N) {
15971588
// We lower some target intrinsics to their target opcode
15981589
// early a node with a target opcode can be of this class
1599-
return N->isMemIntrinsic() ||
1600-
N->getOpcode() == ISD::PREFETCH ||
1601-
N->isTargetMemoryOpcode();
1590+
return N->isMemIntrinsic();
16021591
}
16031592
};
16041593

0 commit comments

Comments
 (0)