[PATCH] D120714: [CodeGen] Use SDNode debug ID declaration in release builds

Daniil Kovalev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 05:13:26 PDT 2022


kovdan01 updated this revision to Diff 415786.
kovdan01 added a comment.

Fix formatting according to pre-merge checks. @dexonsmith Please let me know if you have some comments on the changes. I added more info in my previous comment. Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120714/new/

https://reviews.llvm.org/D120714

Files:
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGPrinter.cpp
@@ -77,11 +77,7 @@
                                               const SelectionDAG *Graph) {
       std::string R;
       raw_string_ostream OS(R);
-#ifndef NDEBUG
       OS << 't' << Node->PersistentId;
-#else
-      OS << static_cast<const void *>(Node);
-#endif
       return R;
     }
 
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
@@ -503,13 +503,8 @@
 }
 
 static Printable PrintNodeId(const SDNode &Node) {
-  return Printable([&Node](raw_ostream &OS) {
-#ifndef NDEBUG
-    OS << 't' << Node.PersistentId;
-#else
-    OS << (const void*)&Node;
-#endif
-  });
+  return Printable(
+      [&Node](raw_ostream &OS) { OS << 't' << Node.PersistentId; });
 }
 
 // Print the MMO with more information from the SelectionDAG.
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -1063,8 +1063,8 @@
 /// verification and other common operations when a new node is allocated.
 void SelectionDAG::InsertNode(SDNode *N) {
   AllNodes.push_back(N);
-#ifndef NDEBUG
   N->PersistentId = NextPersistentId++;
+#ifndef NDEBUG
   VerifySDNode(N);
 #endif
   for (DAGUpdateListener *DUL = UpdateListeners; DUL; DUL = DUL->Next)
@@ -1268,9 +1268,7 @@
   AllNodes.remove(AllNodes.begin());
   while (!AllNodes.empty())
     DeallocateNode(&AllNodes.front());
-#ifndef NDEBUG
   NextPersistentId = 0;
-#endif
 }
 
 SDNode *SelectionDAG::FindNodeOrInsertPos(const FoldingSetNodeID &ID,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120714.415786.patch
Type: text/x-patch
Size: 1989 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220316/92c3501e/attachment.bin>


More information about the llvm-commits mailing list