Skip to content

Commit 3c4dc8d

Browse files
committed
[AMDGPU] Add an option to run AMDGPUAttributorPass in full LTO
Currently `AMDGPUAttributorPass` is registered in default optimizer pipeline. This will allow the pass to run in default pipeline as well as at thinLTO post link stage. However, it will not run in full LTO post link stage. This patch adds an option to run it in full LTO. It is set to false by default.
1 parent 84cc186 commit 3c4dc8d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

llvm/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,11 @@ static cl::opt<bool> EnableSIModeRegisterPass(
301301
cl::init(true),
302302
cl::Hidden);
303303

304+
static cl::opt<bool> EnableAMDGPUAttributorInFullLTO(
305+
"amdgpu-attributor-enable-full-lto",
306+
cl::desc("Enable AMDGPUAttributorPass in full LTO post link stage"),
307+
cl::init(false), cl::Hidden);
308+
304309
// Enable GFX11.5+ s_singleuse_vdst insertion
305310
static cl::opt<bool>
306311
EnableInsertSingleUseVDST("amdgpu-enable-single-use-vdst",
@@ -749,6 +754,8 @@ void AMDGPUTargetMachine::registerPassBuilderCallbacks(PassBuilder &PB) {
749754
// module is partitioned for codegen.
750755
if (EnableLowerModuleLDS)
751756
PM.addPass(AMDGPULowerModuleLDSPass(*this));
757+
if (EnableAMDGPUAttributorInFullLTO)
758+
PM.addPass(AMDGPUAttributorPass(*this));
752759
});
753760

754761
PB.registerRegClassFilterParsingCallback(

0 commit comments

Comments
 (0)