Skip to content

Commit 2560505

Browse files
authored
[AMDGPU] Reorder GCNPassConfig::addOptimizedRegAlloc. NFC. (#115873)
This just makes it so that the added passes are mentioned in this function in the same order that they will appear in the final pass pipeline.
1 parent b6bd747 commit 2560505

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,37 +1415,38 @@ void GCNPassConfig::addFastRegAlloc() {
14151415
}
14161416

14171417
void GCNPassConfig::addOptimizedRegAlloc() {
1418-
// Allow the scheduler to run before SIWholeQuadMode inserts exec manipulation
1419-
// instructions that cause scheduling barriers.
1420-
insertPass(&MachineSchedulerID, &SIWholeQuadModeID);
1421-
1422-
if (OptExecMaskPreRA)
1423-
insertPass(&MachineSchedulerID, &SIOptimizeExecMaskingPreRAID);
1424-
1425-
if (EnableRewritePartialRegUses)
1426-
insertPass(&RenameIndependentSubregsID, &GCNRewritePartialRegUsesID);
1427-
1428-
if (isPassEnabled(EnablePreRAOptimizations))
1429-
insertPass(&RenameIndependentSubregsID, &GCNPreRAOptimizationsID);
1430-
1431-
// This is not an essential optimization and it has a noticeable impact on
1432-
// compilation time, so we only enable it from O2.
1433-
if (TM->getOptLevel() > CodeGenOptLevel::Less)
1434-
insertPass(&MachineSchedulerID, &SIFormMemoryClausesID);
1418+
if (EnableDCEInRA)
1419+
insertPass(&DetectDeadLanesID, &DeadMachineInstructionElimID);
14351420

14361421
// FIXME: when an instruction has a Killed operand, and the instruction is
14371422
// inside a bundle, seems only the BUNDLE instruction appears as the Kills of
14381423
// the register in LiveVariables, this would trigger a failure in verifier,
14391424
// we should fix it and enable the verifier.
14401425
if (OptVGPRLiveRange)
14411426
insertPass(&LiveVariablesID, &SIOptimizeVGPRLiveRangeID);
1427+
14421428
// This must be run immediately after phi elimination and before
14431429
// TwoAddressInstructions, otherwise the processing of the tied operand of
14441430
// SI_ELSE will introduce a copy of the tied operand source after the else.
14451431
insertPass(&PHIEliminationID, &SILowerControlFlowID);
14461432

1447-
if (EnableDCEInRA)
1448-
insertPass(&DetectDeadLanesID, &DeadMachineInstructionElimID);
1433+
if (EnableRewritePartialRegUses)
1434+
insertPass(&RenameIndependentSubregsID, &GCNRewritePartialRegUsesID);
1435+
1436+
if (isPassEnabled(EnablePreRAOptimizations))
1437+
insertPass(&RenameIndependentSubregsID, &GCNPreRAOptimizationsID);
1438+
1439+
// Allow the scheduler to run before SIWholeQuadMode inserts exec manipulation
1440+
// instructions that cause scheduling barriers.
1441+
insertPass(&MachineSchedulerID, &SIWholeQuadModeID);
1442+
1443+
if (OptExecMaskPreRA)
1444+
insertPass(&MachineSchedulerID, &SIOptimizeExecMaskingPreRAID);
1445+
1446+
// This is not an essential optimization and it has a noticeable impact on
1447+
// compilation time, so we only enable it from O2.
1448+
if (TM->getOptLevel() > CodeGenOptLevel::Less)
1449+
insertPass(&MachineSchedulerID, &SIFormMemoryClausesID);
14491450

14501451
TargetPassConfig::addOptimizedRegAlloc();
14511452
}

0 commit comments

Comments
 (0)