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

Jamie Schmeiser via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 5 05:53:57 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:

Yes, this code would only be triggered by -print-changed=dot-cfg; I was just showing comments in the IR.  There is a comment there in the before version, it is on the same line as the label `; preds = %for.cond`
I do not recall the code intentionally removing the label.  As I recall, the IR used to be of the form
```
<optional nl>
; preds = ...
label:
  <code>
```
and the code was designed to remove the predecessors comment.  I suspect that the form of the IR has changed with the comment being moved and the code needs fixing...either way, the point of the line was to remove `; preds = %for.cond` since it is redundant.  
It appears that the pass PowerPC DAG->DAG Pattern Instruction Selection (ppc-isel) is changing the placement of the predecessors comment by injecting a nl, so it appears that the IR is morphing and it isn't surprising that this code has become broken...


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


More information about the llvm-commits mailing list