Skip to content

[LLVM] Skip dumping inline SDag children #141359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 27, 2025

Conversation

jroelofs
Copy link
Contributor

If they're simple enough to render inline, we don't need to dump them again in the recursive walk.

If they're simple enough to render inline, we don't need to dump them again in
the recursive walk.
@llvmbot llvmbot added the llvm:SelectionDAG SelectionDAGISel as well label May 24, 2025
@llvmbot
Copy link
Member

llvmbot commented May 24, 2025

@llvm/pr-subscribers-backend-powerpc

@llvm/pr-subscribers-llvm-selectiondag

Author: Jon Roelofs (jroelofs)

Changes

If they're simple enough to render inline, we don't need to dump them again in the recursive walk.


Full diff: https://github.com/llvm/llvm-project/pull/141359.diff

1 Files Affected:

  • (modified) llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp (+3)
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
index ee4297f3ad8ce..61c6a9470e531 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp
@@ -1165,6 +1165,9 @@ static void printrWithDepthHelper(raw_ostream &OS, const SDNode *N,
     // Don't follow chain operands.
     if (Op.getValueType() == MVT::Other)
       continue;
+    // Don't print children that were fully rendered inline.
+    if (shouldPrintInline(*Op.getNode(), G))
+      continue;
     OS << '\n';
     printrWithDepthHelper(OS, Op.getNode(), G, depth - 1, indent + 2);
   }

@jroelofs
Copy link
Contributor Author

Great suggestion from @fpetrogalli in #141295 to simplify these dumps:

before:
image

after:
image

@topperc
Copy link
Collaborator

topperc commented May 25, 2025

There's a PowerPC test failing that checks the debug output

Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with the PPC test fixed.

@jroelofs jroelofs merged commit 714096c into llvm:main May 27, 2025
11 of 12 checks passed
@jroelofs jroelofs deleted the jroelofs/skip-inline-sdag-children branch May 27, 2025 02:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:PowerPC llvm:SelectionDAG SelectionDAGISel as well
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants