[llvm] [StandardInstrumentations]Add support for numeric label (PR #148844)

Jamie Schmeiser via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 2 09:25:54 PDT 2025


================
@@ -1950,10 +1958,9 @@ std::string DotCfgDiffNode::getBodyContent() const {
   // Drop leading newline, if present.
   if (BS.front() == '\n')
     BS1 = BS1.drop_front(1);
-  // Get label.
-  StringRef Label = BS1.take_until([](char C) { return C == ':'; });
   // drop predecessors as they can be big and are redundant
-  BS1 = BS1.drop_until([](char C) { return C == '\n'; }).drop_front();
+  if (BS1.str().find(Label) != std::string::npos)
----------------
jamieschmeiser wrote:

Some questions:
1) why call str() when you can just use find on the StringRef?
2) why are you adding a condition to dropping the predecessors?  They are dropped since they can be large which can clutter up the diagram.
3) Are you going to find `Label` if it has been manufactured with a number?  In this case, won't you then preserve the predecessors, leading to a cluttered diagram, or is that the whole point of storing the label -- so that you know when to retain predecessors since there is no label?

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


More information about the llvm-commits mailing list