[llvm] [SelectionDAG] Simplify classof of MemSDNode and MemIntrinsicSDNode (NFC) (PR #115720)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 11 13:05:40 PST 2024


================
@@ -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; }
----------------
topperc wrote:

Thanks for the clarification.

> Assuming there is no (pre-existing) undefined behavior, just checking the bit is more robust as the method will now return false for ordinary SDNodes erroneously created with isTargetMemoryOpcode opcodes.

I think that would be considered a bug.

https://github.com/llvm/llvm-project/pull/115720


More information about the llvm-commits mailing list