Skip to content

Commit 862f504

Browse files
authored
[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.
1 parent 11aa31f commit 862f504

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,11 @@ static cl::opt<bool> EnableHipStdPar(
383383
cl::desc("Enable HIP Standard Parallelism Offload support"), cl::init(false),
384384
cl::Hidden);
385385

386+
static cl::opt<bool>
387+
EnableAMDGPUAttributor("amdgpu-attributor-enable",
388+
cl::desc("Enable AMDGPUAttributorPass"),
389+
cl::init(true), cl::Hidden);
390+
386391
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeAMDGPUTarget() {
387392
// Register the target
388393
RegisterTargetMachine<R600TargetMachine> X(getTheR600Target());
@@ -762,6 +767,8 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
762767
// module is partitioned for codegen.
763768
if (EnableLowerModuleLDS)
764769
PM.addPass(AMDGPULowerModuleLDSPass(*this));
770+
if (EnableAMDGPUAttributor && Level != OptimizationLevel::O0)
771+
PM.addPass(AMDGPUAttributorPass(*this));
765772
});
766773

767774
PB.registerRegClassFilterParsingCallback(
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)