[PATCH] D12720: isUndef() interface for SDNode - proposal

Elena Demikhovsky via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 9 01:50:35 PDT 2015

delena created this revision.
delena added reviewers: chandlerc, nadav, spatel.
delena added a subscriber: llvm-commits.
delena set the repository for this revision to rL LLVM.

I'd like to add isUndef() interface to SDNode, it is really missing for me
The code
(V1.getOpcode() == ISD::UNDEF)

will look 


What do you think?




Index: include/llvm/CodeGen/SelectionDAGNodes.h
--- include/llvm/CodeGen/SelectionDAGNodes.h
+++ include/llvm/CodeGen/SelectionDAGNodes.h
@@ -167,6 +167,7 @@
   inline bool isTargetMemoryOpcode() const;
   inline bool isTargetOpcode() const;
   inline bool isMachineOpcode() const;
+  inline bool isUndef() const;
   inline unsigned getMachineOpcode() const;
   inline const DebugLoc &getDebugLoc() const;
   inline void dump() const;
@@ -395,6 +396,9 @@
     return NodeType >= ISD::FIRST_TARGET_MEMORY_OPCODE;
+  /// Return true if the type of the node type undefined.
+  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
@@ -909,6 +913,9 @@
 inline unsigned SDValue::getMachineOpcode() const {
   return Node->getMachineOpcode();
+inline bool SDValue::isUndef() const {
+  return Node->isUndef();
 inline bool SDValue::use_empty() const {
   return !Node->hasAnyUseOfValue(ResNo);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12720.34300.patch
Type: text/x-patch
Size: 1209 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150909/1c0289dc/attachment.bin>

More information about the llvm-commits mailing list