@@ -1337,7 +1337,8 @@ static void addPreloadKernArgHint(Function &F, TargetMachine &TM) {
13371337}
13381338
13391339static bool runImpl (Module &M, AnalysisGetter &AG, TargetMachine &TM,
1340- AMDGPUAttributorOptions Options) {
1340+ AMDGPUAttributorOptions Options,
1341+ ThinOrFullLTOPhase LTOPhase) {
13411342 SetVector<Function *> Functions;
13421343 for (Function &F : M) {
13431344 if (!F.isIntrinsic ())
@@ -1372,9 +1373,27 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
13721373
13731374 Attributor A (Functions, InfoCache, AC);
13741375
1375- LLVM_DEBUG (dbgs () << " [AMDGPUAttributor] Module " << M.getName () << " is "
1376- << (AC.IsClosedWorldModule ? " " : " not " )
1377- << " assumed to be a closed world.\n " );
1376+ LLVM_DEBUG ({
1377+ auto PhaseToString = [](ThinOrFullLTOPhase LTOPhase) -> StringRef {
1378+ switch (LTOPhase) {
1379+ case ThinOrFullLTOPhase::None:
1380+ return " None" ;
1381+ case ThinOrFullLTOPhase::ThinLTOPreLink:
1382+ return " ThinLTOPreLink" ;
1383+ case ThinOrFullLTOPhase::ThinLTOPostLink:
1384+ return " ThinLTOPostLink" ;
1385+ case ThinOrFullLTOPhase::FullLTOPreLink:
1386+ return " FullLTOPreLink" ;
1387+ case ThinOrFullLTOPhase::FullLTOPostLink:
1388+ return " FullLTOPostLink" ;
1389+ }
1390+ };
1391+ StringRef LTOPhaseStr = PhaseToString (LTOPhase);
1392+ dbgs () << " [AMDGPUAttributor] Running at phase " << LTOPhaseStr << ' \n '
1393+ << " [AMDGPUAttributor] Module " << M.getName () << " is "
1394+ << (AC.IsClosedWorldModule ? " " : " not " )
1395+ << " assumed to be a closed world.\n " ;
1396+ });
13781397
13791398 for (auto *F : Functions) {
13801399 A.getOrCreateAAFor <AAAMDAttributes>(IRPosition::function (*F));
@@ -1427,7 +1446,8 @@ class AMDGPUAttributorLegacy : public ModulePass {
14271446
14281447 bool runOnModule (Module &M) override {
14291448 AnalysisGetter AG (this );
1430- return runImpl (M, AG, *TM, /* Options=*/ {});
1449+ return runImpl (M, AG, *TM, /* Options=*/ {},
1450+ /* LTOPhase=*/ ThinOrFullLTOPhase::None);
14311451 }
14321452
14331453 void getAnalysisUsage (AnalysisUsage &AU) const override {
@@ -1448,8 +1468,8 @@ PreservedAnalyses llvm::AMDGPUAttributorPass::run(Module &M,
14481468 AnalysisGetter AG (FAM);
14491469
14501470 // TODO: Probably preserves CFG
1451- return runImpl (M, AG, TM, Options) ? PreservedAnalyses::none ()
1452- : PreservedAnalyses::all ();
1471+ return runImpl (M, AG, TM, Options, LTOPhase ) ? PreservedAnalyses::none ()
1472+ : PreservedAnalyses::all ();
14531473}
14541474
14551475char AMDGPUAttributorLegacy::ID = 0 ;
0 commit comments