@@ -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,27 @@ 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+ auto PhaseToString = [](ThinOrFullLTOPhase LTOPhase) -> StringRef {
1384+ switch (LTOPhase) {
1385+ case ThinOrFullLTOPhase::None:
1386+ return " None" ;
1387+ case ThinOrFullLTOPhase::ThinLTOPreLink:
1388+ return " ThinLTOPreLink" ;
1389+ case ThinOrFullLTOPhase::ThinLTOPostLink:
1390+ return " ThinLTOPostLink" ;
1391+ case ThinOrFullLTOPhase::FullLTOPreLink:
1392+ return " FullLTOPreLink" ;
1393+ case ThinOrFullLTOPhase::FullLTOPostLink:
1394+ return " FullLTOPostLink" ;
1395+ }
1396+ };
1397+ StringRef LTOPhaseStr = PhaseToString (LTOPhase);
1398+ dbgs () << " [AMDGPUAttributor] Running at phase " << LTOPhaseStr << ' \n '
1399+ << " [AMDGPUAttributor] Module " << M.getName () << " is "
1400+ << (AC.IsClosedWorldModule ? " " : " not " )
1401+ << " assumed to be a closed world.\n " ;
1402+ });
13841403
13851404 for (auto *F : Functions) {
13861405 A.getOrCreateAAFor <AAAMDAttributes>(IRPosition::function (*F));
@@ -1433,7 +1452,8 @@ class AMDGPUAttributorLegacy : public ModulePass {
14331452
14341453 bool runOnModule (Module &M) override {
14351454 AnalysisGetter AG (this );
1436- return runImpl (M, AG, *TM, /* Options=*/ {});
1455+ return runImpl (M, AG, *TM, /* Options=*/ {},
1456+ /* LTOPhase=*/ ThinOrFullLTOPhase::None);
14371457 }
14381458
14391459 void getAnalysisUsage (AnalysisUsage &AU) const override {
@@ -1454,8 +1474,8 @@ PreservedAnalyses llvm::AMDGPUAttributorPass::run(Module &M,
14541474 AnalysisGetter AG (FAM);
14551475
14561476 // TODO: Probably preserves CFG
1457- return runImpl (M, AG, TM, Options) ? PreservedAnalyses::none ()
1458- : PreservedAnalyses::all ();
1477+ return runImpl (M, AG, TM, Options, LTOPhase ) ? PreservedAnalyses::none ()
1478+ : PreservedAnalyses::all ();
14591479}
14601480
14611481char AMDGPUAttributorLegacy::ID = 0 ;
0 commit comments