diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -1033,6 +1033,12 @@ addPass(createSIShrinkInstructionsPass()); addPass(createSIModeRegisterPass()); + if (getOptLevel() > CodeGenOpt::None) + addPass(&SIInsertHardClausesID); + + addPass(&SIRemoveShortExecBranchesID); + addPass(&SIInsertSkipsPassID); + addPass(&SIPreEmitPeepholeID); // 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 @@ -1045,12 +1051,6 @@ // FIXME: This stand-alone pass will emit indiv. S_NOP 0, as needed. It would // be better for it to emit S_NOP when possible. addPass(&PostRAHazardRecognizerID); - if (getOptLevel() > CodeGenOpt::None) - addPass(&SIInsertHardClausesID); - - addPass(&SIRemoveShortExecBranchesID); - addPass(&SIInsertSkipsPassID); - addPass(&SIPreEmitPeepholeID); addPass(&BranchRelaxationPassID); }