diff options
author | Mark Searles <m.c.searles@gmail.com> | 2018-07-16 10:02:41 +0000 |
---|---|---|
committer | Mark Searles <m.c.searles@gmail.com> | 2018-07-16 10:02:41 +0000 |
commit | 72da47df2514bd54b0d9378280625591f9dd2f9e (patch) | |
tree | 0aa97bb31fda298e3fd93fc969a4e85c14609813 /llvm/lib | |
parent | c2d5d9adb549fe0374aa6ef60365effafbd580a6 (diff) | |
download | bcm5719-llvm-72da47df2514bd54b0d9378280625591f9dd2f9e.tar.gz bcm5719-llvm-72da47df2514bd54b0d9378280625591f9dd2f9e.zip |
run post-RA hazard recognizer pass late
Memory legalizer, waitcnt, and shrink passes can perturb the instructions,
which means that the post-RA hazard recognizer pass should run after them.
Otherwise, one of those passes may invalidate the work done by the hazard
recognizer. Note that this has adverse side-effect that any consecutive
S_NOP 0's, emitted by the hazard recognizer, will not be shrunk into a
single S_NOP <N>. This should be addressed in a follow-on patch.
Differential Revision: https://reviews.llvm.org/D49288
llvm-svn: 337154
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 10 | ||||
-rw-r--r-- | llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index 7dfe33b52c3..2205819c444 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -886,6 +886,10 @@ void GCNPassConfig::addPreSched2() { } void GCNPassConfig::addPreEmitPass() { + addPass(createSIMemoryLegalizerPass()); + addPass(createSIInsertWaitcntsPass()); + addPass(createSIShrinkInstructionsPass()); + // The hazard recognizer that runs as part of the post-ra scheduler does not // guarantee to be able handle all hazards correctly. This is because if there // are multiple scheduling regions in a basic block, the regions are scheduled @@ -894,11 +898,11 @@ void GCNPassConfig::addPreEmitPass() { // // Here we add a stand-alone hazard recognizer pass which can handle all // cases. + // + // FIXME: This stand-alone pass will emit indiv. S_NOP 0, as needed. It would + // be better for it to emit S_NOP <N> when possible. addPass(&PostRAHazardRecognizerID); - addPass(createSIMemoryLegalizerPass()); - addPass(createSIInsertWaitcntsPass()); - addPass(createSIShrinkInstructionsPass()); addPass(&SIInsertSkipsPassID); addPass(createSIDebuggerInsertNopsPass()); addPass(&BranchRelaxationPassID); diff --git a/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp b/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp index 4e1200ad4f1..938cdaf1ef8 100644 --- a/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp +++ b/llvm/lib/Target/AMDGPU/SIMemoryLegalizer.cpp @@ -737,7 +737,7 @@ bool SIGfx6CacheControl::insertWait(MachineBasicBlock::iterator &MI, case SIAtomicScope::WAVEFRONT: case SIAtomicScope::SINGLETHREAD: // The L1 cache keeps all memory operations in order for - // wavesfronts in the same work-group. + // wavefronts in the same work-group. break; default: llvm_unreachable("Unsupported synchronization scope"); |