[llvm] [GlobalISel] Dump the machine function after each legalization iteration. NFC (PR #83401)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 9 23:12:50 PST 2024
https://github.com/davemgreen updated https://github.com/llvm/llvm-project/pull/83401
>From 77c96322df512d605785744f30845aed032daacf Mon Sep 17 00:00:00 2001
From: David Green <david.green at arm.com>
Date: Sun, 10 Mar 2024 07:12:40 +0000
Subject: [PATCH] [GlobalISel] Dump the machine function after each
legalization iteration. NFC
I find this useful to see the current state of the machine function as
legalization continues. Otherwise it is difficult to view the whole status
as individual combines/legalizations are occuring.
---
llvm/lib/CodeGen/GlobalISel/Legalizer.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
index 6d75258c1041b1..c4ccefc69f6b59 100644
--- a/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Legalizer.cpp
@@ -221,8 +221,14 @@ Legalizer::legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI,
LegalizationArtifactCombiner ArtCombiner(MIRBuilder, MRI, LI, KB);
bool Changed = false;
SmallVector<MachineInstr *, 128> RetryList;
+ unsigned Iteration = 0;
do {
- LLVM_DEBUG(dbgs() << "=== New Iteration ===\n");
+ LLVM_DEBUG({
+ if (Iteration > 0) {
+ dbgs() << "=== New Iteration: " << Iteration << " ===\n";
+ MF.dump();
+ }
+ });
assert(RetryList.empty() && "Expected no instructions in RetryList");
unsigned NumArtifacts = ArtifactList.size();
while (!InstList.empty()) {
@@ -302,6 +308,8 @@ Legalizer::legalizeMachineFunction(MachineFunction &MF, const LegalizerInfo &LI,
InstList.insert(&MI);
}
}
+
+ ++Iteration;
} while (!InstList.empty());
return {Changed, /*FailedOn*/ nullptr};
More information about the llvm-commits
mailing list