@@ -1334,7 +1334,8 @@ static void addPreloadKernArgHint(Function &F, TargetMachine &TM) {
13341334}
13351335
13361336static bool runImpl (Module &M, AnalysisGetter &AG, TargetMachine &TM,
1337- AMDGPUAttributorOptions Options) {
1337+ AMDGPUAttributorOptions Options,
1338+ ThinOrFullLTOPhase LTOPhase) {
13381339 SetVector<Function *> Functions;
13391340 for (Function &F : M) {
13401341 if (!F.isIntrinsic ())
@@ -1369,9 +1370,27 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
13691370
13701371 Attributor A (Functions, InfoCache, AC);
13711372
1372- LLVM_DEBUG (dbgs () << " [AMDGPUAttributor] Module " << M.getName () << " is "
1373- << (AC.IsClosedWorldModule ? " " : " not " )
1374- << " assumed to be a closed world.\n " );
1373+ LLVM_DEBUG ({
1374+ auto PhaseToString = [](ThinOrFullLTOPhase LTOPhase) -> StringRef {
1375+ switch (LTOPhase) {
1376+ case ThinOrFullLTOPhase::None:
1377+ return " None" ;
1378+ case ThinOrFullLTOPhase::ThinLTOPreLink:
1379+ return " ThinLTOPreLink" ;
1380+ case ThinOrFullLTOPhase::ThinLTOPostLink:
1381+ return " ThinLTOPostLink" ;
1382+ case ThinOrFullLTOPhase::FullLTOPreLink:
1383+ return " FullLTOPreLink" ;
1384+ case ThinOrFullLTOPhase::FullLTOPostLink:
1385+ return " FullLTOPostLink" ;
1386+ }
1387+ };
1388+ StringRef LTOPhaseStr = PhaseToString (LTOPhase);
1389+ dbgs () << " [AMDGPUAttributor] Running at phase " << LTOPhaseStr << ' \n '
1390+ << " [AMDGPUAttributor] Module " << M.getName () << " is "
1391+ << (AC.IsClosedWorldModule ? " " : " not " )
1392+ << " assumed to be a closed world.\n " ;
1393+ });
13751394
13761395 for (auto *F : Functions) {
13771396 A.getOrCreateAAFor <AAAMDAttributes>(IRPosition::function (*F));
@@ -1424,7 +1443,8 @@ class AMDGPUAttributorLegacy : public ModulePass {
14241443
14251444 bool runOnModule (Module &M) override {
14261445 AnalysisGetter AG (this );
1427- return runImpl (M, AG, *TM, /* Options=*/ {});
1446+ return runImpl (M, AG, *TM, /* Options=*/ {},
1447+ /* LTOPhase=*/ ThinOrFullLTOPhase::None);
14281448 }
14291449
14301450 void getAnalysisUsage (AnalysisUsage &AU) const override {
@@ -1445,8 +1465,8 @@ PreservedAnalyses llvm::AMDGPUAttributorPass::run(Module &M,
14451465 AnalysisGetter AG (FAM);
14461466
14471467 // TODO: Probably preserves CFG
1448- return runImpl (M, AG, TM, Options) ? PreservedAnalyses::none ()
1449- : PreservedAnalyses::all ();
1468+ return runImpl (M, AG, TM, Options, LTOPhase ) ? PreservedAnalyses::none ()
1469+ : PreservedAnalyses::all ();
14501470}
14511471
14521472char AMDGPUAttributorLegacy::ID = 0 ;
0 commit comments