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 @@ -1106,9 +1106,6 @@ EnableLowerKernelArguments) addPass(createAMDGPULowerKernelArgumentsPass()); - if (TM->getOptLevel() > CodeGenOpt::Less) - addPass(&AMDGPUPerfHintAnalysisID); - TargetPassConfig::addCodeGenPrepare(); if (isPassEnabled(EnableLoadStoreVectorizer)) @@ -1219,6 +1216,9 @@ } addPass(createLCSSAPass()); + if (TM->getOptLevel() > CodeGenOpt::Less) + addPass(&AMDGPUPerfHintAnalysisID); + return false; } diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll --- a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll +++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll @@ -769,8 +769,6 @@ ; GCN-O2-NEXT: AMDGPU Annotate Kernel Features ; GCN-O2-NEXT: FunctionPass Manager ; GCN-O2-NEXT: AMDGPU Lower Kernel Arguments -; GCN-O2-NEXT: Analysis if a function is memory bound -; GCN-O2-NEXT: FunctionPass Manager ; GCN-O2-NEXT: Dominator Tree Construction ; GCN-O2-NEXT: Natural Loop Information ; GCN-O2-NEXT: CodeGen Prepare @@ -819,6 +817,7 @@ ; GCN-O2-NEXT: SI annotate control flow ; GCN-O2-NEXT: LCSSA Verifier ; GCN-O2-NEXT: Loop-Closed SSA Form Pass +; GCN-O2-NEXT: Analysis if a function is memory bound ; GCN-O2-NEXT: DummyCGSCCPass ; GCN-O2-NEXT: FunctionPass Manager ; GCN-O2-NEXT: Safe Stack instrumentation pass @@ -1068,8 +1067,6 @@ ; GCN-O3-NEXT: AMDGPU Annotate Kernel Features ; GCN-O3-NEXT: FunctionPass Manager ; GCN-O3-NEXT: AMDGPU Lower Kernel Arguments -; GCN-O3-NEXT: Analysis if a function is memory bound -; GCN-O3-NEXT: FunctionPass Manager ; GCN-O3-NEXT: Dominator Tree Construction ; GCN-O3-NEXT: Natural Loop Information ; GCN-O3-NEXT: CodeGen Prepare @@ -1118,6 +1115,7 @@ ; GCN-O3-NEXT: SI annotate control flow ; GCN-O3-NEXT: LCSSA Verifier ; GCN-O3-NEXT: Loop-Closed SSA Form Pass +; GCN-O3-NEXT: Analysis if a function is memory bound ; GCN-O3-NEXT: DummyCGSCCPass ; GCN-O3-NEXT: FunctionPass Manager ; GCN-O3-NEXT: Safe Stack instrumentation pass