Lines Matching full:scc
49 template class AllAnalysesOn<LazyCallGraph::SCC>;
50 template class AnalysisManager<LazyCallGraph::SCC, LazyCallGraph &>;
51 template class PassManager<LazyCallGraph::SCC, CGSCCAnalysisManager,
55 LazyCallGraph::SCC, LazyCallGraph &>;
62 PassManager<LazyCallGraph::SCC, CGSCCAnalysisManager, LazyCallGraph &,
63 CGSCCUpdateResult &>::run(LazyCallGraph::SCC &InitialC, in run()
73 // The SCC may be refined while we are running passes over it, so set up in run()
75 LazyCallGraph::SCC *C = &InitialC; in run()
89 // Update the SCC if necessary. in run()
102 // If the CGSCC pass wasn't able to provide a valid updated SCC, the in run()
103 // current SCC may simply need to be skipped if invalid. in run()
105 PI.runAfterPassInvalidated<LazyCallGraph::SCC>(*Pass, PassPA); in run()
106 LLVM_DEBUG(dbgs() << "Skipping invalidated root or island SCC!\n"); in run()
111 assert(C->begin() != C->end() && "Cannot have an empty SCC!"); in run()
117 PI.runAfterPass<LazyCallGraph::SCC>(*Pass, *C, PassPA); in run()
120 // Before we mark all of *this* SCC's analyses as preserved below, intersect in run()
121 // this with the cross-SCC preserved analysis set. This is used to allow in run()
127 // SCC. Therefore, the remaining analysis results in the AnalysisManager are in run()
130 PA.preserveSet<AllAnalysesOn<LazyCallGraph::SCC>>(); in run()
151 SmallPriorityWorklist<LazyCallGraph::SCC *, 1> CWorklist; in run()
155 SmallPtrSet<LazyCallGraph::SCC *, 4> InvalidSCCSet; in run()
157 SmallDenseSet<std::pair<LazyCallGraph::Node *, LazyCallGraph::SCC *>, 4> in run()
196 "Should always start with an empty SCC worklist"); in run()
198 LLVM_DEBUG(dbgs() << "Running an SCC pass across the RefSCC: " << *RC in run()
201 // The top of the worklist may *also* be the same SCC we just ran over in run()
202 // (and invalidated for). Keep track of that last SCC we processed due in run()
203 // to SCC update to avoid redundant processing when an SCC is both just in run()
205 LazyCallGraph::SCC *LastUpdatedC = nullptr; in run()
209 for (LazyCallGraph::SCC &C : llvm::reverse(*RC)) in run()
213 LazyCallGraph::SCC *C = CWorklist.pop_back_val(); in run()
219 LLVM_DEBUG(dbgs() << "Skipping an invalid SCC...\n"); in run()
223 LLVM_DEBUG(dbgs() << "Skipping redundant run on SCC: " << *C << "\n"); in run()
226 // We used to also check if the current SCC is part of the current in run()
239 // the first time we see this SCC. in run()
243 // Each time we visit a new SCC pulled off the worklist, in run()
244 // a transformation of a child SCC may have also modified this parent in run()
246 // cross-SCC preserved set. This preserved set is intersected by any in run()
248 // to marking its SCC as preserved. That lets us track everything that in run()
250 // on a single SCC. in run()
252 // This essentially allows SCC passes to freely invalidate analyses in run()
253 // of any ancestor SCC. If this becomes detrimental to successfully in run()
254 // caching analyses, we could force each SCC pass to manually in run()
262 assert(!InvalidSCCSet.count(C) && "Processing an invalid SCC!"); in run()
263 assert(C->begin() != C->end() && "Cannot have an empty SCC!"); in run()
271 if (!PI.runBeforePass<LazyCallGraph::SCC>(*Pass, *C)) in run()
276 // Update the SCC and RefSCC if necessary. in run()
280 // If we're updating the SCC, also update the FAM inside the proxy's in run()
286 // Intersect with the cross-SCC preserved set to capture any in run()
287 // cross-SCC invalidation. in run()
293 // If the CGSCC pass wasn't able to provide a valid updated SCC, in run()
294 // the current SCC may simply need to be skipped if invalid. in run()
296 PI.runAfterPassInvalidated<LazyCallGraph::SCC>(*Pass, PassPA); in run()
297 LLVM_DEBUG(dbgs() << "Skipping invalidated root or island SCC!\n"); in run()
302 assert(C->begin() != C->end() && "Cannot have an empty SCC!"); in run()
305 // for the (potentially updated) SCC here. Note that any other SCCs in run()
307 // whatever was updating the call graph. This SCC gets invalidated in run()
312 PI.runAfterPass<LazyCallGraph::SCC>(*Pass, *C, PassPA); in run()
315 // current SCC and/or RefSCC. We need to update our current SCC and in run()
316 // RefSCC pointers to follow these. Also, when the current SCC is in run()
317 // refined, re-run the SCC pass over the newly refined SCC in order in run()
318 // to observe the most precise SCC model available. This inherently in run()
325 << "Re-running SCC passes after a refinement of the " in run()
326 "current SCC: " in run()
330 // invalid SCC and RefSCCs respectively. But we will short circuit in run()
351 // By definition we preserve the call garph, all SCC analyses, and the in run()
353 PA.preserveSet<AllAnalysesOn<LazyCallGraph::SCC>>(); in run()
360 PreservedAnalyses DevirtSCCRepeatedPass::run(LazyCallGraph::SCC &InitialC, in run()
368 // The SCC may be refined while we are running passes over it, so set up in run()
370 LazyCallGraph::SCC *C = &InitialC; in run()
373 // of the SCC. in run()
380 // direct calls for each function in the SCC. in run()
381 auto ScanSCC = [](LazyCallGraph::SCC &C, in run()
410 if (!PI.runBeforePass<LazyCallGraph::SCC>(*Pass, *C)) in run()
417 // If the CGSCC pass wasn't able to provide a valid updated SCC, the in run()
418 // current SCC may simply need to be skipped if invalid. in run()
420 PI.runAfterPassInvalidated<LazyCallGraph::SCC>(*Pass, PassPA); in run()
421 LLVM_DEBUG(dbgs() << "Skipping invalidated root or island SCC!\n"); in run()
429 PI.runAfterPass<LazyCallGraph::SCC>(*Pass, *C, PassPA); in run()
431 // If the SCC structure has changed, bail immediately and let the outer in run()
436 assert(C->begin() != C->end() && "Cannot have an empty SCC!"); in run()
459 // of direct calls for any function in the SCC. This can be fooled by all in run()
489 << MaxIterations << ") on SCC: " << *C << "\n"); in run()
494 dbgs() << "Repeating an SCC pass after finding a devirtualization in: " in run()
507 PreservedAnalyses CGSCCToFunctionPassAdaptor::run(LazyCallGraph::SCC &C, in run()
519 // The SCC may get split while we are optimizing functions due to deleting in run()
520 // edges. If this happens, the current SCC can shift, so keep track of in run()
522 LazyCallGraph::SCC *CurrentC = &C; in run()
524 LLVM_DEBUG(dbgs() << "Running function passes across an SCC: " << C << "\n"); in run()
557 // function pass. This may also update the current SCC to point to in run()
558 // a smaller, more refined SCC. in run()
564 "Current SCC not updated to the SCC containing the current node!"); in run()
595 // entire SCC layer as well rather than trying to do invalidation ourselves. in invalidate()
611 PA.allAnalysesInSetPreserved<AllAnalysesOn<LazyCallGraph::SCC>>(); in invalidate()
621 // for this SCC. in invalidate()
644 // preserve all SCC analyses. in invalidate()
657 // be accessed in an SCC analysis and proxied onward to function passes. in run()
668 FunctionAnalysisManagerCGSCCProxy::run(LazyCallGraph::SCC &C, in run()
690 LazyCallGraph::SCC &C, const PreservedAnalyses &PA, in invalidate()
705 if (!PAC.preserved() && !PAC.preservedSet<AllAnalysesOn<LazyCallGraph::SCC>>()) { in invalidate()
723 // SCC-level analysis invalidation that triggers deferred invalidation in invalidate()
758 /// When a new SCC is created for the graph we first update the
761 /// that SCC, two forms of updates are required.
763 /// First, a proxy from the SCC to the FunctionAnalysisManager needs to be
764 /// created so that any subsequent invalidation events to the SCC are
767 /// Second, if any of the functions within the SCC have analysis results with
769 /// *wrong* SCC's analysis result. We forcibly invalidate the necessary
771 static void updateNewSCCFunctionAnalyses(LazyCallGraph::SCC &C, in updateNewSCCFunctionAnalyses()
777 // Now walk the functions in this SCC and invalidate any function analysis in updateNewSCCFunctionAnalyses()
778 // results that might have outer dependencies on an SCC analysis. in updateNewSCCFunctionAnalyses()
807 /// The range of new SCCs must be in postorder already. The SCC they were split
811 /// This function returns the SCC containing \p N. This will be either \p C if
812 /// no new SCCs have been split out, or it will be the new SCC containing \p N.
814 static LazyCallGraph::SCC *
816 LazyCallGraph::Node &N, LazyCallGraph::SCC *C, in incorporateNewSCCRange()
818 using SCC = LazyCallGraph::SCC; in incorporateNewSCCRange() typedef
823 // Add the current SCC to the worklist as its shape has changed. in incorporateNewSCCRange()
825 LLVM_DEBUG(dbgs() << "Enqueuing the existing SCC in the worklist:" << *C in incorporateNewSCCRange()
828 SCC *OldC = C; in incorporateNewSCCRange()
830 // Update the current SCC. Note that if we have new SCCs, this must actually in incorporateNewSCCRange()
831 // change the SCC. in incorporateNewSCCRange()
833 "Cannot insert new SCCs without changing current SCC!"); in incorporateNewSCCRange()
835 assert(G.lookupSCC(N) == C && "Failed to update current SCC!"); in incorporateNewSCCRange()
838 // them for each SCC that was split off. in incorporateNewSCCRange()
844 // We need to propagate an invalidation call to all but the newly current SCC in incorporateNewSCCRange()
855 // Ensure the now-current SCC's function analyses are updated. in incorporateNewSCCRange()
859 for (SCC &NewC : llvm::reverse(llvm::drop_begin(NewSCCRange))) { in incorporateNewSCCRange()
860 assert(C != &NewC && "No need to re-visit the current SCC!"); in incorporateNewSCCRange()
861 assert(OldC != &NewC && "Already handled the original SCC!"); in incorporateNewSCCRange()
863 LLVM_DEBUG(dbgs() << "Enqueuing a newly formed SCC:" << NewC << "\n"); in incorporateNewSCCRange()
869 // Also propagate a normal invalidation to the new SCC as only the current in incorporateNewSCCRange()
876 static LazyCallGraph::SCC &updateCGAndAnalysisManagerForPass( in updateCGAndAnalysisManagerForPass()
877 LazyCallGraph &G, LazyCallGraph::SCC &InitialC, LazyCallGraph::Node &N, in updateCGAndAnalysisManagerForPass()
882 using SCC = LazyCallGraph::SCC; in updateCGAndAnalysisManagerForPass() typedef
886 SCC *C = &InitialC; in updateCGAndAnalysisManagerForPass()
963 SCC &TargetC = *G.lookupSCC(*RefTarget); in updateCGAndAnalysisManagerForPass()
976 SCC &TargetC = *G.lookupSCC(*CallTarget); in updateCGAndAnalysisManagerForPass()
1004 SCC &TargetC = *G.lookupSCC(E.getNode()); in updateCGAndAnalysisManagerForPass()
1022 SCC &TargetC = *G.lookupSCC(*TargetN); in updateCGAndAnalysisManagerForPass()
1040 SCC &TargetC = *G.lookupSCC(*RefTarget); in updateCGAndAnalysisManagerForPass()
1076 SCC &TargetC = *G.lookupSCC(*CallTarget); in updateCGAndAnalysisManagerForPass()
1101 N, *CallTarget, [&](ArrayRef<SCC *> MergedSCCs) { in updateCGAndAnalysisManagerForPass()
1102 for (SCC *MergedC : MergedSCCs) { in updateCGAndAnalysisManagerForPass()
1103 assert(MergedC != &TargetC && "Cannot merge away the target SCC!"); in updateCGAndAnalysisManagerForPass()
1109 // Mark that this SCC will no longer be valid. in updateCGAndAnalysisManagerForPass()
1125 assert(G.lookupSCC(N) == C && "Failed to update current SCC!"); in updateCGAndAnalysisManagerForPass()
1128 // analysis manager, we need to create a proxy in the new current SCC as in updateCGAndAnalysisManagerForPass()
1133 // Any analyses cached for this SCC are no longer precise as the shape in updateCGAndAnalysisManagerForPass()
1141 // If we have actually moved an SCC to be topologically "below" the current in updateCGAndAnalysisManagerForPass()
1142 // one due to merging, we will need to revisit the current SCC after in updateCGAndAnalysisManagerForPass()
1145 // It is critical that we *do not* revisit the current SCC unless we in updateCGAndAnalysisManagerForPass()
1147 // form a cycle where an SCC is split apart, merged, split, merged and so in updateCGAndAnalysisManagerForPass()
1150 // Put our current SCC back onto the worklist as we'll visit other SCCs in updateCGAndAnalysisManagerForPass()
1153 // optimize the current SCC. in updateCGAndAnalysisManagerForPass()
1155 LLVM_DEBUG(dbgs() << "Enqueuing the existing SCC in the worklist: " << *C in updateCGAndAnalysisManagerForPass()
1158 for (SCC &MovedC : llvm::reverse(make_range(RC->begin() + InitialSCCIndex, in updateCGAndAnalysisManagerForPass()
1161 LLVM_DEBUG(dbgs() << "Enqueuing a newly earlier in post-order SCC: " in updateCGAndAnalysisManagerForPass()
1167 assert(!UR.InvalidatedSCCs.count(C) && "Invalidated the current SCC!"); in updateCGAndAnalysisManagerForPass()
1168 assert(&C->getOuterRefSCC() == RC && "Current SCC not in current RefSCC!"); in updateCGAndAnalysisManagerForPass()
1170 // Record the current SCC for higher layers of the CGSCC pass manager now that in updateCGAndAnalysisManagerForPass()
1178 LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass( in updateCGAndAnalysisManagerForFunctionPass()
1179 LazyCallGraph &G, LazyCallGraph::SCC &InitialC, LazyCallGraph::Node &N, in updateCGAndAnalysisManagerForFunctionPass()
1185 LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForCGSCCPass( in updateCGAndAnalysisManagerForCGSCCPass()
1186 LazyCallGraph &G, LazyCallGraph::SCC &InitialC, LazyCallGraph::Node &N, in updateCGAndAnalysisManagerForCGSCCPass()