@@ -86,11 +86,6 @@ PassManager<LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &,
86
86
87
87
PreservedAnalyses PassPA = Pass->run (*C, AM, G, UR);
88
88
89
- if (UR.InvalidatedSCCs .count (C))
90
- PI.runAfterPassInvalidated <LazyCallGraph::SCC>(*Pass, PassPA);
91
- else
92
- PI.runAfterPass <LazyCallGraph::SCC>(*Pass, *C, PassPA);
93
-
94
89
// Update the SCC if necessary.
95
90
C = UR.UpdatedC ? UR.UpdatedC : C;
96
91
if (UR.UpdatedC ) {
@@ -107,6 +102,7 @@ PassManager<LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &,
107
102
// If the CGSCC pass wasn't able to provide a valid updated SCC, the
108
103
// current SCC may simply need to be skipped if invalid.
109
104
if (UR.InvalidatedSCCs .count (C)) {
105
+ PI.runAfterPassInvalidated <LazyCallGraph::SCC>(*Pass, PassPA);
110
106
LLVM_DEBUG (dbgs () << " Skipping invalidated root or island SCC!\n " );
111
107
break ;
112
108
}
@@ -117,6 +113,8 @@ PassManager<LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &,
117
113
// Update the analysis manager as each pass runs and potentially
118
114
// invalidates analyses.
119
115
AM.invalidate (*C, PassPA);
116
+
117
+ PI.runAfterPass <LazyCallGraph::SCC>(*Pass, *C, PassPA);
120
118
}
121
119
122
120
// Before we mark all of *this* SCC's analyses as preserved below, intersect
@@ -276,11 +274,6 @@ ModuleToPostOrderCGSCCPassAdaptor::run(Module &M, ModuleAnalysisManager &AM) {
276
274
277
275
PreservedAnalyses PassPA = Pass->run (*C, CGAM, CG, UR);
278
276
279
- if (UR.InvalidatedSCCs .count (C))
280
- PI.runAfterPassInvalidated <LazyCallGraph::SCC>(*Pass, PassPA);
281
- else
282
- PI.runAfterPass <LazyCallGraph::SCC>(*Pass, *C, PassPA);
283
-
284
277
// Update the SCC and RefSCC if necessary.
285
278
C = UR.UpdatedC ? UR.UpdatedC : C;
286
279
@@ -301,6 +294,7 @@ ModuleToPostOrderCGSCCPassAdaptor::run(Module &M, ModuleAnalysisManager &AM) {
301
294
// If the CGSCC pass wasn't able to provide a valid updated SCC,
302
295
// the current SCC may simply need to be skipped if invalid.
303
296
if (UR.InvalidatedSCCs .count (C)) {
297
+ PI.runAfterPassInvalidated <LazyCallGraph::SCC>(*Pass, PassPA);
304
298
LLVM_DEBUG (dbgs () << " Skipping invalidated root or island SCC!\n " );
305
299
break ;
306
300
}
@@ -316,6 +310,8 @@ ModuleToPostOrderCGSCCPassAdaptor::run(Module &M, ModuleAnalysisManager &AM) {
316
310
// processed.
317
311
CGAM.invalidate (*C, PassPA);
318
312
313
+ PI.runAfterPass <LazyCallGraph::SCC>(*Pass, *C, PassPA);
314
+
319
315
// The pass may have restructured the call graph and refined the
320
316
// current SCC and/or RefSCC. We need to update our current SCC and
321
317
// RefSCC pointers to follow these. Also, when the current SCC is
@@ -408,25 +404,27 @@ PreservedAnalyses DevirtSCCRepeatedPass::run(LazyCallGraph::SCC &InitialC,
408
404
409
405
PreservedAnalyses PassPA = Pass->run (*C, AM, CG, UR);
410
406
411
- if (UR.InvalidatedSCCs .count (C))
412
- PI.runAfterPassInvalidated <LazyCallGraph::SCC>(*Pass, PassPA);
413
- else
414
- PI.runAfterPass <LazyCallGraph::SCC>(*Pass, *C, PassPA);
415
-
416
407
PA.intersect (PassPA);
417
408
418
- // If the SCC structure has changed, bail immediately and let the outer
419
- // CGSCC layer handle any iteration to reflect the refined structure.
420
- if (UR.UpdatedC && UR.UpdatedC != C)
421
- break ;
422
-
423
409
// If the CGSCC pass wasn't able to provide a valid updated SCC, the
424
410
// current SCC may simply need to be skipped if invalid.
425
411
if (UR.InvalidatedSCCs .count (C)) {
412
+ PI.runAfterPassInvalidated <LazyCallGraph::SCC>(*Pass, PassPA);
426
413
LLVM_DEBUG (dbgs () << " Skipping invalidated root or island SCC!\n " );
427
414
break ;
428
415
}
429
416
417
+ // Update the analysis manager with each run and intersect the total set
418
+ // of preserved analyses so we're ready to iterate.
419
+ AM.invalidate (*C, PassPA);
420
+
421
+ PI.runAfterPass <LazyCallGraph::SCC>(*Pass, *C, PassPA);
422
+
423
+ // If the SCC structure has changed, bail immediately and let the outer
424
+ // CGSCC layer handle any iteration to reflect the refined structure.
425
+ if (UR.UpdatedC && UR.UpdatedC != C)
426
+ break ;
427
+
430
428
assert (C->begin () != C->end () && " Cannot have an empty SCC!" );
431
429
432
430
// Check whether any of the handles were devirtualized.
@@ -490,10 +488,6 @@ PreservedAnalyses DevirtSCCRepeatedPass::run(LazyCallGraph::SCC &InitialC,
490
488
491
489
// Move over the new call counts in preparation for iterating.
492
490
CallCounts = std::move (NewCallCounts);
493
-
494
- // Update the analysis manager with each run and intersect the total set
495
- // of preserved analyses so we're ready to iterate.
496
- AM.invalidate (*C, PassPA);
497
491
}
498
492
499
493
// Note that we don't add any preserved entries here unlike a more normal
@@ -539,13 +533,14 @@ PreservedAnalyses CGSCCToFunctionPassAdaptor::run(LazyCallGraph::SCC &C,
539
533
continue ;
540
534
541
535
PreservedAnalyses PassPA = Pass->run (F, FAM);
542
- PI.runAfterPass <Function>(*Pass, F, PassPA);
543
536
544
537
// We know that the function pass couldn't have invalidated any other
545
538
// function's analyses (that's the contract of a function pass), so
546
539
// directly handle the function analysis manager's invalidation here.
547
540
FAM.invalidate (F, EagerlyInvalidate ? PreservedAnalyses::none () : PassPA);
548
541
542
+ PI.runAfterPass <Function>(*Pass, F, PassPA);
543
+
549
544
// Then intersect the preserved set so that invalidation of module
550
545
// analyses will eventually occur when the module pass completes.
551
546
PA.intersect (std::move (PassPA));
0 commit comments