[llvm] 862f504 - [AMDGPU] Enable AMDGPUAttributorPass in full LTO (#102673)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 10:39:26 PDT 2024
Author: Shilei Tian
Date: 2024-08-12T13:39:23-04:00
New Revision: 862f5040fb854b5ca0aba2d3088396201bf7db9a
URL: https://github.com/llvm/llvm-project/commit/862f5040fb854b5ca0aba2d3088396201bf7db9a
DIFF: https://github.com/llvm/llvm-project/commit/862f5040fb854b5ca0aba2d3088396201bf7db9a.diff
LOG: [AMDGPU] Enable AMDGPUAttributorPass in full LTO (#102673)
This is basically same as
https://github.com/llvm/llvm-project/pull/102086 but reverts some test
case changes that are no longer needed.
Added:
llvm/test/CodeGen/AMDGPU/print-pipeline-passes.ll
Modified:
llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
index 0523fee5bcf9f..d82be9a7e9041 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp
@@ -383,6 +383,11 @@ static cl::opt<bool> EnableHipStdPar(
cl::desc("Enable HIP Standard Parallelism Offload support"), cl::init(false),
cl::Hidden);
+static cl::opt<bool>
+ EnableAMDGPUAttributor("amdgpu-attributor-enable",
+ cl::desc("Enable AMDGPUAttributorPass"),
+ cl::init(true), cl::Hidden);
+
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
// Register the target
RegisterTargetMachine<R600TargetMachine> X(getTheR600Target());
@@ -762,6 +767,8 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
// module is partitioned for codegen.
if (EnableLowerModuleLDS)
PM.addPass(AMDGPULowerModuleLDSPass(*this));
+ if (EnableAMDGPUAttributor && Level != OptimizationLevel::O0)
+ PM.addPass(AMDGPUAttributorPass(*this));
});
PB.registerRegClassFilterParsingCallback(
diff --git a/llvm/test/CodeGen/AMDGPU/print-pipeline-passes.ll b/llvm/test/CodeGen/AMDGPU/print-pipeline-passes.ll
new file mode 100644
index 0000000000000..b9eda0c1cd3bb
--- /dev/null
+++ b/llvm/test/CodeGen/AMDGPU/print-pipeline-passes.ll
@@ -0,0 +1,12 @@
+; RUN: opt -mtriple=amdgcn--amdhsa -S -passes="lto<O0>" -print-pipeline-passes %s -o - | FileCheck --check-prefix=O0 %s
+; RUN: opt -mtriple=amdgcn--amdhsa -S -passes="lto<O1>" -print-pipeline-passes %s -o - | FileCheck %s
+; RUN: opt -mtriple=amdgcn--amdhsa -S -passes="lto<O2>" -print-pipeline-passes %s -o - | FileCheck %s
+; RUN: opt -mtriple=amdgcn--amdhsa -S -passes="lto<O3>" -print-pipeline-passes %s -o - | FileCheck %s
+
+; CHECK: amdgpu-attributor
+; O0-NOT: amdgpu-attributor
+
+define amdgpu_kernel void @kernel() {
+entry:
+ ret void
+}
More information about the llvm-commits
mailing list