Skip to content

Commit c2ff0eb

Browse files
committedAug 29, 2016
AMDGPU/SI: Improve SILoadStoreOptimizer and run it before the scheduler
Summary: The SILoadStoreOptimizer can now look ahead more then one instruction when looking for instructions to merge, which greatly improves the number of loads/stores that we are able to merge. Moving the pass before scheduling avoids increasing register pressure after the scheduler, so that the scheduler's register pressure estimates will be more accurate. It also gives more consistent results, since it is no longer affected by minor scheduling changes. Reviewers: arsenm Subscribers: arsenm, kzhuravl, llvm-commits Differential Revision: https://reviews.llvm.org/D23814 llvm-svn: 279991
1 parent c10c334 commit c2ff0eb

12 files changed

+209
-150
lines changed
 

‎llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

+1-11
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ void GCNPassConfig::addMachineSSAOptimization() {
497497
// XXX - Can we get away without running DeadMachineInstructionElim again?
498498
addPass(&SIFoldOperandsID);
499499
addPass(&DeadMachineInstructionElimID);
500+
addPass(&SILoadStoreOptimizerID);
500501
}
501502

502503
void GCNPassConfig::addIRPasses() {
@@ -533,17 +534,6 @@ bool GCNPassConfig::addGlobalInstructionSelect() {
533534
#endif
534535

535536
void GCNPassConfig::addPreRegAlloc() {
536-
if (getOptLevel() > CodeGenOpt::None) {
537-
// Don't do this with no optimizations since it throws away debug info by
538-
// merging nonadjacent loads.
539-
540-
// This should be run after scheduling, but before register allocation. It
541-
// also need extra copies to the address operand to be eliminated.
542-
543-
// FIXME: Move pre-RA and remove extra reg coalescer run.
544-
insertPass(&MachineSchedulerID, &SILoadStoreOptimizerID);
545-
insertPass(&MachineSchedulerID, &RegisterCoalescerID);
546-
}
547537

548538
addPass(createSIShrinkInstructionsPass());
549539
addPass(createSIWholeQuadModePass());

0 commit comments

Comments
 (0)
Please sign in to comment.