[llvm] a583654 - GlobalISel: Add debug print for applied rule in generated combiner
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 14 16:12:01 PST 2022
Author: Matt Arsenault
Date: 2022-11-14T15:59:05-08:00
New Revision: a583654a8b1767190e08f2ec568841c6aaad4e3c
URL: https://github.com/llvm/llvm-project/commit/a583654a8b1767190e08f2ec568841c6aaad4e3c
DIFF: https://github.com/llvm/llvm-project/commit/a583654a8b1767190e08f2ec568841c6aaad4e3c.diff
LOG: GlobalISel: Add debug print for applied rule in generated combiner
Added:
Modified:
llvm/test/TableGen/GICombinerEmitter/match-tree.td
llvm/utils/TableGen/GICombinerEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/test/TableGen/GICombinerEmitter/match-tree.td b/llvm/test/TableGen/GICombinerEmitter/match-tree.td
index e1f0f423e70c1..6ca1e4b3c0cc1 100644
--- a/llvm/test/TableGen/GICombinerEmitter/match-tree.td
+++ b/llvm/test/TableGen/GICombinerEmitter/match-tree.td
@@ -239,6 +239,7 @@ def MyCombinerHelper: GICombinerHelper<"GenMyCombinerHelper", [
// CODE-NEXT: if (!RuleConfig->isRuleDisabled(0)) {
// CODE-NEXT: if (1
// CODE-NEXT:) {
+// CODE-NEXT: LLVM_DEBUG(dbgs() << "Applying rule 'Rule0'\n");
// CODE-NEXT: APPLY
// CODE-NEXT: return true;
// CODE-NEXT: }
@@ -259,6 +260,7 @@ def MyCombinerHelper: GICombinerHelper<"GenMyCombinerHelper", [
// CODE-NEXT: Subtarget->hasFoo()
// CODE-NEXT: )
// CODE-NEXT:) {
+// CODE-NEXT: LLVM_DEBUG(dbgs() << "Applying rule 'Rule5'\n");
// CODE-NEXT: APPLY
// CODE-NEXT: return true;
// CODE-NEXT: }
@@ -280,6 +282,7 @@ def MyCombinerHelper: GICombinerHelper<"GenMyCombinerHelper", [
// CODE-NEXT: Subtarget->hasFoo()
// CODE-NEXT: )
// CODE-NEXT: ) {
+// CODE-NEXT: LLVM_DEBUG(dbgs() << "Applying rule 'Rule5'\n");
// CODE-NEXT: APPLY
// CODE-NEXT: return true;
// CODE-NEXT: }
@@ -305,6 +308,7 @@ def MyCombinerHelper: GICombinerHelper<"GenMyCombinerHelper", [
// CODE-NEXT: Subtarget->getAnswerToUniverse() == 42 && Subtarget->getAnswerToLife() == 42
// CODE-NEXT: )
// CODE-NEXT: ) {
+// CODE-NEXT: LLVM_DEBUG(dbgs() << "Applying rule 'Rule6'\n");
// CODE-NEXT: APPLY
// CODE-NEXT: return true;
// CODE-NEXT: }
diff --git a/llvm/utils/TableGen/GICombinerEmitter.cpp b/llvm/utils/TableGen/GICombinerEmitter.cpp
index 266186bf94527..14f24654c7ad4 100644
--- a/llvm/utils/TableGen/GICombinerEmitter.cpp
+++ b/llvm/utils/TableGen/GICombinerEmitter.cpp
@@ -823,16 +823,19 @@ void GICombinerEmitter::generateCodeForTree(raw_ostream &OS,
<< Indent << " "
<< CodeExpander(Rule->getMatchingFixupCode()->getValue(), Expansions,
RuleDef.getLoc(), ShowExpansions)
- << "\n"
+ << '\n'
<< Indent << " return true;\n"
<< Indent << " }()";
}
OS << Indent << " ) {\n" << Indent << " ";
if (const StringInit *Code = dyn_cast<StringInit>(Applyer->getArg(0))) {
- OS << CodeExpander(Code->getAsUnquotedString(), Expansions,
+ OS << " LLVM_DEBUG(dbgs() << \"Applying rule '"
+ << RuleDef.getName()
+ << "'\\n\");\n"
+ << CodeExpander(Code->getAsUnquotedString(), Expansions,
RuleDef.getLoc(), ShowExpansions)
- << "\n"
+ << '\n'
<< Indent << " return true;\n"
<< Indent << " }\n";
} else {
More information about the llvm-commits
mailing list