From d01b34ed31467073bd1a0f0040da4d74db20475e Mon Sep 17 00:00:00 2001 From: Stanislav Mekhanoshin Date: Thu, 8 Jul 2021 11:00:57 -0700 Subject: [PATCH] [AMDGPU] Move perfhint analysis This is SCC pass, moving it to the end of SCC PM saves one Function PM. This needs the analysis to take into account memory access width since it is now places after the load/store optimizer (D105651). Differential Revision: https://reviews.llvm.org/D105652 --- llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp | 6 +++--- llvm/test/CodeGen/AMDGPU/llc-pipeline.ll | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp index bfb5f29..b40f7b0 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp @@ -1106,9 +1106,6 @@ void AMDGPUPassConfig::addCodeGenPrepare() { EnableLowerKernelArguments) addPass(createAMDGPULowerKernelArgumentsPass()); - if (TM->getOptLevel() > CodeGenOpt::Less) - addPass(&AMDGPUPerfHintAnalysisID); - TargetPassConfig::addCodeGenPrepare(); if (isPassEnabled(EnableLoadStoreVectorizer)) @@ -1219,6 +1216,9 @@ bool GCNPassConfig::addPreISel() { } 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 index 33d318b..698d116 100644 --- 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 -- 2.7.4