Skip to content

Commit 8207c81

Browse files
committed
[Legalizer] More detailed debugging printing in main loop
1 parent ed83942 commit 8207c81

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

llvm/lib/CodeGen/GlobalISel/Legalizer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
215215
bool Changed = false;
216216
SmallVector<MachineInstr *, 128> RetryList;
217217
do {
218+
LLVM_DEBUG(dbgs() << "=== New Iteration ===\n");
218219
assert(RetryList.empty() && "Expected no instructions in RetryList");
219220
unsigned NumArtifacts = ArtifactList.size();
220221
while (!InstList.empty()) {
@@ -235,6 +236,7 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
235236
// legalizing InstList may generate artifacts that allow
236237
// ArtifactCombiner to combine away them.
237238
if (isArtifact(MI)) {
239+
LLVM_DEBUG(dbgs() << ".. Not legalized, moving to artifacts retry\n");
238240
RetryList.push_back(&MI);
239241
continue;
240242
}
@@ -251,6 +253,7 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
251253
while (!RetryList.empty())
252254
ArtifactList.insert(RetryList.pop_back_val());
253255
} else {
256+
LLVM_DEBUG(dbgs() << "No new artifacts created, not retrying!\n");
254257
MachineInstr *MI = *RetryList.begin();
255258
stopLegalizing(*MI);
256259
return false;
@@ -266,6 +269,7 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
266269
continue;
267270
}
268271
SmallVector<MachineInstr *, 4> DeadInstructions;
272+
LLVM_DEBUG(dbgs() << "Trying to combine: " << MI);
269273
if (ArtCombiner.tryCombineInstruction(MI, DeadInstructions,
270274
WrapperObserver)) {
271275
WorkListObserver.printNewInstrs();
@@ -280,8 +284,10 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
280284
// If this was not an artifact (that could be combined away), this might
281285
// need special handling. Add it to InstList, so when it's processed
282286
// there, it has to be legal or specially handled.
283-
else
287+
else {
288+
LLVM_DEBUG(dbgs() << ".. Not combined, moving to instructions list\n");
284289
InstList.insert(&MI);
290+
}
285291
}
286292
} while (!InstList.empty());
287293

0 commit comments

Comments
 (0)