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

Ruoyu Qiu via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 02:53:50 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)
----------------
cabbaken wrote:

2. Could you clarify what the comment here refers to? I previously thought that the in-memory LLVM IR does not have a representation for comments.  
And I'm sorry about the misunderstanding of `drop_until`.
3. It's right that different ordering will cause a bad output. 
The passes do not record the label change history, so it is difficult to locate the corresponding non-label BB before and after a pass. In fact, in my patch, we will apply the numeric label to the BBs before and after the passes. So the negative integer may not work properly in this context. 
This issue may need to be addressed in a separate PR.


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


More information about the llvm-commits mailing list