Skip to content

Commit dab6a0d

Browse files
shiltianDavid Salinas
authored and
David Salinas
committed
[AMDGPU] Enable AMDGPUAttributorPass in full LTO (llvm#102673)
This is basically same as llvm#102086 but reverts some test case changes that are no longer needed. (cherry picked from commit 862f504) Change-Id: Icc620b3afc6eacc6fea00d91176be054feaf3a6c
1 parent 3ffe686 commit dab6a0d

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

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

441+
static cl::opt<bool>
442+
EnableAMDGPUAttributor("amdgpu-attributor-enable",
443+
cl::desc("Enable AMDGPUAttributorPass"),
444+
cl::init(true), cl::Hidden);
445+
441446
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
442447
// Register the target
443448
RegisterTargetMachine<R600TargetMachine> X(getTheR600Target());
@@ -811,6 +816,8 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
811816
// module is partitioned for codegen.
812817
if (EnableLowerModuleLDS)
813818
PM.addPass(AMDGPULowerModuleLDSPass(*this));
819+
if (EnableAMDGPUAttributor && Level != OptimizationLevel::O0)
820+
PM.addPass(AMDGPUAttributorPass(*this));
814821
});
815822

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

0 commit comments

Comments
 (0)