@@ -215,6 +215,7 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
215
215
bool Changed = false ;
216
216
SmallVector<MachineInstr *, 128 > RetryList;
217
217
do {
218
+ LLVM_DEBUG (dbgs () << " === New Iteration ===\n " );
218
219
assert (RetryList.empty () && " Expected no instructions in RetryList" );
219
220
unsigned NumArtifacts = ArtifactList.size ();
220
221
while (!InstList.empty ()) {
@@ -235,6 +236,7 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
235
236
// legalizing InstList may generate artifacts that allow
236
237
// ArtifactCombiner to combine away them.
237
238
if (isArtifact (MI)) {
239
+ LLVM_DEBUG (dbgs () << " .. Not legalized, moving to artifacts retry\n " );
238
240
RetryList.push_back (&MI);
239
241
continue ;
240
242
}
@@ -251,6 +253,7 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
251
253
while (!RetryList.empty ())
252
254
ArtifactList.insert (RetryList.pop_back_val ());
253
255
} else {
256
+ LLVM_DEBUG (dbgs () << " No new artifacts created, not retrying!\n " );
254
257
MachineInstr *MI = *RetryList.begin ();
255
258
stopLegalizing (*MI);
256
259
return false ;
@@ -266,6 +269,7 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
266
269
continue ;
267
270
}
268
271
SmallVector<MachineInstr *, 4 > DeadInstructions;
272
+ LLVM_DEBUG (dbgs () << " Trying to combine: " << MI);
269
273
if (ArtCombiner.tryCombineInstruction (MI, DeadInstructions,
270
274
WrapperObserver)) {
271
275
WorkListObserver.printNewInstrs ();
@@ -280,8 +284,10 @@ bool Legalizer::runOnMachineFunction(MachineFunction &MF) {
280
284
// If this was not an artifact (that could be combined away), this might
281
285
// need special handling. Add it to InstList, so when it's processed
282
286
// there, it has to be legal or specially handled.
283
- else
287
+ else {
288
+ LLVM_DEBUG (dbgs () << " .. Not combined, moving to instructions list\n " );
284
289
InstList.insert (&MI);
290
+ }
285
291
}
286
292
} while (!InstList.empty ());
287
293
0 commit comments