[llvm] [SelectionDAG] Simplify classof of MemSDNode and MemIntrinsicSDNode (NFC) (PR #115720)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 11 06:37:07 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-selectiondag
Author: Sergei Barannikov (s-barannikov)
<details>
<summary>Changes</summary>
`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.
---
Full diff: https://github.com/llvm/llvm-project/pull/115720.diff
1 Files Affected:
- (modified) llvm/include/llvm/CodeGen/SelectionDAGNodes.h (+3-14)
``````````diff
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
index 739ce05e947346..677b59e0c8fbeb 100644
--- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
+++ b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h
@@ -708,15 +708,7 @@ END_TWO_BYTE_PACK()
bool isUndef() const { return NodeType == ISD::UNDEF; }
/// Test if this node is a memory intrinsic (with valid pointer information).
- /// INTRINSIC_W_CHAIN and INTRINSIC_VOID nodes are sometimes created for
- /// non-memory intrinsics (with chains) that are not really instances of
- /// MemSDNode. For such nodes, we need some extra state to determine the
- /// proper classof relationship.
- bool isMemIntrinsic() const {
- return (NodeType == ISD::INTRINSIC_W_CHAIN ||
- NodeType == ISD::INTRINSIC_VOID) &&
- SDNodeBits.IsMemIntrinsic;
- }
+ bool isMemIntrinsic() const { return SDNodeBits.IsMemIntrinsic; }
/// Test if this node is a strict floating point pseudo-op.
bool isStrictFPOpcode() {
@@ -1464,7 +1456,6 @@ class MemSDNode : public SDNode {
switch (N->getOpcode()) {
case ISD::LOAD:
case ISD::STORE:
- case ISD::PREFETCH:
case ISD::ATOMIC_CMP_SWAP:
case ISD::ATOMIC_CMP_SWAP_WITH_SUCCESS:
case ISD::ATOMIC_SWAP:
@@ -1504,7 +1495,7 @@ class MemSDNode : public SDNode {
case ISD::EXPERIMENTAL_VECTOR_HISTOGRAM:
return true;
default:
- return N->isMemIntrinsic() || N->isTargetMemoryOpcode();
+ return N->isMemIntrinsic();
}
}
};
@@ -1596,9 +1587,7 @@ class MemIntrinsicSDNode : public MemSDNode {
static bool classof(const SDNode *N) {
// We lower some target intrinsics to their target opcode
// early a node with a target opcode can be of this class
- return N->isMemIntrinsic() ||
- N->getOpcode() == ISD::PREFETCH ||
- N->isTargetMemoryOpcode();
+ return N->isMemIntrinsic();
}
};
``````````
</details>
https://github.com/llvm/llvm-project/pull/115720
More information about the llvm-commits
mailing list