@@ -1343,7 +1343,8 @@ static void addPreloadKernArgHint(Function &F, TargetMachine &TM) {
13431343}
13441344
13451345static bool runImpl (Module &M, AnalysisGetter &AG, TargetMachine &TM,
1346- AMDGPUAttributorOptions Options) {
1346+ AMDGPUAttributorOptions Options,
1347+ ThinOrFullLTOPhase LTOPhase) {
13471348 SetVector<Function *> Functions;
13481349 for (Function &F : M) {
13491350 if (!F.isIntrinsic ())
@@ -1378,9 +1379,13 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
13781379
13791380 Attributor A (Functions, InfoCache, AC);
13801381
1381- LLVM_DEBUG (dbgs () << " [AMDGPUAttributor] Module " << M.getName () << " is "
1382- << (AC.IsClosedWorldModule ? " " : " not " )
1383- << " assumed to be a closed world.\n " );
1382+ LLVM_DEBUG ({
1383+ StringRef LTOPhaseStr = to_string (LTOPhase);
1384+ dbgs () << " [AMDGPUAttributor] Running at phase " << LTOPhaseStr << ' \n '
1385+ << " [AMDGPUAttributor] Module " << M.getName () << " is "
1386+ << (AC.IsClosedWorldModule ? " " : " not " )
1387+ << " assumed to be a closed world.\n " ;
1388+ });
13841389
13851390 for (auto *F : Functions) {
13861391 A.getOrCreateAAFor <AAAMDAttributes>(IRPosition::function (*F));
@@ -1433,7 +1438,8 @@ class AMDGPUAttributorLegacy : public ModulePass {
14331438
14341439 bool runOnModule (Module &M) override {
14351440 AnalysisGetter AG (this );
1436- return runImpl (M, AG, *TM, /* Options=*/ {});
1441+ return runImpl (M, AG, *TM, /* Options=*/ {},
1442+ /* LTOPhase=*/ ThinOrFullLTOPhase::None);
14371443 }
14381444
14391445 void getAnalysisUsage (AnalysisUsage &AU) const override {
@@ -1454,8 +1460,8 @@ PreservedAnalyses llvm::AMDGPUAttributorPass::run(Module &M,
14541460 AnalysisGetter AG (FAM);
14551461
14561462 // TODO: Probably preserves CFG
1457- return runImpl (M, AG, TM, Options) ? PreservedAnalyses::none ()
1458- : PreservedAnalyses::all ();
1463+ return runImpl (M, AG, TM, Options, LTOPhase ) ? PreservedAnalyses::none ()
1464+ : PreservedAnalyses::all ();
14591465}
14601466
14611467char AMDGPUAttributorLegacy::ID = 0 ;
0 commit comments