[llvm] 3aa24ea - [SelectionDAG] Simplify classof of MemSDNode and MemIntrinsicSDNode (NFC) (#115720)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 22:36:36 PST 2024


Author: Sergei Barannikov
Date: 2024-11-12T09:36:32+03:00
New Revision: 3aa24eae52aa463ce47b528879a9a24e04956b88

URL: https://github.com/llvm/llvm-project/commit/3aa24eae52aa463ce47b528879a9a24e04956b88
DIFF: https://github.com/llvm/llvm-project/commit/3aa24eae52aa463ce47b528879a9a24e04956b88.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/include/llvm/CodeGen/SelectionDAGNodes.h

Removed: 
    


################################################################################
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();
   }
 };
 


        


More information about the llvm-commits mailing list