@@ -1330,7 +1330,8 @@ static void addPreloadKernArgHint(Function &F, TargetMachine &TM) {
1330
1330
}
1331
1331
1332
1332
static bool runImpl (Module &M, AnalysisGetter &AG, TargetMachine &TM,
1333
- AMDGPUAttributorOptions Options) {
1333
+ AMDGPUAttributorOptions Options,
1334
+ ThinOrFullLTOPhase LTOPhase) {
1334
1335
SetVector<Function *> Functions;
1335
1336
for (Function &F : M) {
1336
1337
if (!F.isIntrinsic ())
@@ -1365,9 +1366,30 @@ static bool runImpl(Module &M, AnalysisGetter &AG, TargetMachine &TM,
1365
1366
1366
1367
Attributor A (Functions, InfoCache, AC);
1367
1368
1368
- LLVM_DEBUG (dbgs () << " [AMDGPUAttributor] Module " << M.getName () << " is "
1369
- << (AC.IsClosedWorldModule ? " " : " not " )
1370
- << " assumed to be a closed world.\n " );
1369
+ LLVM_DEBUG ({
1370
+ StringRef LTOPhaseStr;
1371
+ switch (LTOPhase) {
1372
+ case ThinOrFullLTOPhase::None:
1373
+ LTOPhaseStr = " None" ;
1374
+ break ;
1375
+ case ThinOrFullLTOPhase::ThinLTOPreLink:
1376
+ LTOPhaseStr = " ThinLTOPreLink" ;
1377
+ break ;
1378
+ case ThinOrFullLTOPhase::ThinLTOPostLink:
1379
+ LTOPhaseStr = " ThinLTOPostLink" ;
1380
+ break ;
1381
+ case ThinOrFullLTOPhase::FullLTOPreLink:
1382
+ LTOPhaseStr = " FullLTOPreLink" ;
1383
+ break ;
1384
+ case ThinOrFullLTOPhase::FullLTOPostLink:
1385
+ LTOPhaseStr = " FullLTOPostLink" ;
1386
+ break ;
1387
+ }
1388
+ dbgs () << " [AMDGPUAttributor] Running at phase " << LTOPhaseStr << ' \n ' ;
1389
+ dbgs () << " [AMDGPUAttributor] Module " << M.getName () << " is "
1390
+ << (AC.IsClosedWorldModule ? " " : " not " )
1391
+ << " assumed to be a closed world.\n " ;
1392
+ });
1371
1393
1372
1394
for (auto *F : Functions) {
1373
1395
A.getOrCreateAAFor <AAAMDAttributes>(IRPosition::function (*F));
@@ -1420,7 +1442,8 @@ class AMDGPUAttributorLegacy : public ModulePass {
1420
1442
1421
1443
bool runOnModule (Module &M) override {
1422
1444
AnalysisGetter AG (this );
1423
- return runImpl (M, AG, *TM, /* Options=*/ {});
1445
+ return runImpl (M, AG, *TM, /* Options=*/ {},
1446
+ /* LTOPhase=*/ ThinOrFullLTOPhase::None);
1424
1447
}
1425
1448
1426
1449
void getAnalysisUsage (AnalysisUsage &AU) const override {
@@ -1441,8 +1464,8 @@ PreservedAnalyses llvm::AMDGPUAttributorPass::run(Module &M,
1441
1464
AnalysisGetter AG (FAM);
1442
1465
1443
1466
// TODO: Probably preserves CFG
1444
- return runImpl (M, AG, TM, Options) ? PreservedAnalyses::none ()
1445
- : PreservedAnalyses::all ();
1467
+ return runImpl (M, AG, TM, Options, LTOPhase ) ? PreservedAnalyses::none ()
1468
+ : PreservedAnalyses::all ();
1446
1469
}
1447
1470
1448
1471
char AMDGPUAttributorLegacy::ID = 0 ;
0 commit comments