Skip to content

Commit f729dad

Browse files
committed
[AMDGPU] Enable AMDGPUAttributorPass in full LTO
1 parent bbefd57 commit f729dad

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,11 @@ static cl::opt<bool> EnableHipStdPar(
381381
cl::desc("Enable HIP Standard Parallelism Offload support"), cl::init(false),
382382
cl::Hidden);
383383

384+
static cl::opt<bool>
385+
EnableAMDGPUAttributor("amdgpu-attributor-enable",
386+
cl::desc("Enable AMDGPUAttributorPass"),
387+
cl::init(true), cl::Hidden);
388+
384389
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
385390
// Register the target
386391
RegisterTargetMachine<R600TargetMachine> X(getTheR600Target());
@@ -750,6 +755,8 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
750755
// module is partitioned for codegen.
751756
if (EnableLowerModuleLDS)
752757
PM.addPass(AMDGPULowerModuleLDSPass(*this));
758+
if (EnableAMDGPUAttributor && Level != OptimizationLevel::O0)
759+
PM.addPass(AMDGPUAttributorPass(*this));
753760
});
754761

755762
PB.registerRegClassFilterParsingCallback(
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
; RUN: opt -mtriple=amdgcn--amdhsa -S -passes="lto<O1>" -print-pipeline-passes %s -o - | FileCheck %s
2+
; RUN: opt -mtriple=amdgcn--amdhsa -S -passes="lto<O2>" -print-pipeline-passes %s -o - | FileCheck %s
3+
; RUN: opt -mtriple=amdgcn--amdhsa -S -passes="lto<O3>" -print-pipeline-passes %s -o - | FileCheck %s
4+
5+
; CHECK: amdgpu-attributor
6+
7+
define amdgpu_kernel void @kernel() {
8+
entry:
9+
ret void
10+
}

0 commit comments

Comments
 (0)