Skip to content

Commit

Permalink
AMDGPU/SI: Improve SILoadStoreOptimizer and run it before the scheduler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tstellarAMD committed Aug 29, 2016
1 parent c10c334 commit c2ff0eb
Show file tree
Hide file tree
Showing 12 changed files with 209 additions and 150 deletions.
12 changes: 1 addition & 11 deletions llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
Expand Up @@ -497,6 +497,7 @@ void GCNPassConfig::addMachineSSAOptimization() {
// XXX - Can we get away without running DeadMachineInstructionElim again?
addPass(&SIFoldOperandsID);
addPass(&DeadMachineInstructionElimID);
addPass(&SILoadStoreOptimizerID);
}

void GCNPassConfig::addIRPasses() {
Expand Down Expand Up @@ -533,17 +534,6 @@ bool GCNPassConfig::addGlobalInstructionSelect() {
#endif

void GCNPassConfig::addPreRegAlloc() {
if (getOptLevel() > CodeGenOpt::None) {
// Don't do this with no optimizations since it throws away debug info by
// merging nonadjacent loads.

// This should be run after scheduling, but before register allocation. It
// also need extra copies to the address operand to be eliminated.

// FIXME: Move pre-RA and remove extra reg coalescer run.
insertPass(&MachineSchedulerID, &SILoadStoreOptimizerID);
insertPass(&MachineSchedulerID, &RegisterCoalescerID);
}

addPass(createSIShrinkInstructionsPass());
addPass(createSIWholeQuadModePass());
Expand Down

0 comments on commit c2ff0eb

Please sign in to comment.