@@ -1337,7 +1337,8 @@ static void addPreloadKernArgHint(Function &F, TargetMachine &TM) {
1337
1337
}
1338
1338
1339
1339
static bool runImpl (Module &M, AnalysisGetter &AG, TargetMachine &TM,
1340
- AMDGPUAttributorOptions Options) {
1340
+ AMDGPUAttributorOptions Options,
1341
+ ThinOrFullLTOPhase LTOPhase) {
1341
1342
SetVector<Function *> Functions;
1342
1343
for (Function &F : M) {
1343
1344
if (!F.isIntrinsic ())
@@ -1372,9 +1373,27 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
1372
1373
1373
1374
Attributor A (Functions, InfoCache, AC);
1374
1375
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
+ });
1378
1397
1379
1398
for (auto *F : Functions) {
1380
1399
A.getOrCreateAAFor <AAAMDAttributes>(IRPosition::function (*F));
@@ -1427,7 +1446,8 @@ class AMDGPUAttributorLegacy : public ModulePass {
1427
1446
1428
1447
bool runOnModule (Module &M) override {
1429
1448
AnalysisGetter AG (this );
1430
- return runImpl (M, AG, *TM, /* Options=*/ {});
1449
+ return runImpl (M, AG, *TM, /* Options=*/ {},
1450
+ /* LTOPhase=*/ ThinOrFullLTOPhase::None);
1431
1451
}
1432
1452
1433
1453
void getAnalysisUsage (AnalysisUsage &AU) const override {
@@ -1448,8 +1468,8 @@ PreservedAnalyses llvm::AMDGPUAttributorPass::run(Module &M,
1448
1468
AnalysisGetter AG (FAM);
1449
1469
1450
1470
// 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 ();
1453
1473
}
1454
1474
1455
1475
char AMDGPUAttributorLegacy::ID = 0 ;
0 commit comments