[llvm] ffa2bbc - [RDF] Print something useful for NodeId == 0 instead of crashing
Krzysztof Parzyszek via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 14 06:18:12 PDT 2023
Author: Krzysztof Parzyszek
Date: 2023-06-14T06:17:33-07:00
New Revision: ffa2bbc7f4af99ee839e20d6ee73b2d1a2a5ef73
URL: https://github.com/llvm/llvm-project/commit/ffa2bbc7f4af99ee839e20d6ee73b2d1a2a5ef73
DIFF: https://github.com/llvm/llvm-project/commit/ffa2bbc7f4af99ee839e20d6ee73b2d1a2a5ef73.diff
LOG: [RDF] Print something useful for NodeId == 0 instead of crashing
Added:
Modified:
llvm/lib/CodeGen/RDFGraph.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/RDFGraph.cpp b/llvm/lib/CodeGen/RDFGraph.cpp
index dc35ca3708a4c..013cced603506 100644
--- a/llvm/lib/CodeGen/RDFGraph.cpp
+++ b/llvm/lib/CodeGen/RDFGraph.cpp
@@ -48,6 +48,8 @@ raw_ostream &operator<<(raw_ostream &OS, const Print<RegisterRef> &P) {
}
raw_ostream &operator<<(raw_ostream &OS, const Print<NodeId> &P) {
+ if (P.Obj == 0)
+ return OS << "null";
auto NA = P.G.addr<NodeBase *>(P.Obj);
uint16_t Attrs = NA.Addr->getAttrs();
uint16_t Kind = NodeAttrs::kind(Attrs);
More information about the llvm-commits
mailing list