[llvm] [Coroutines] properly update CallGraph in CoroSplit (PR #107935)

Yuxuan Chen via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 12 10:54:56 PDT 2024


================
@@ -2080,12 +2080,13 @@ splitCoroutine(Function &F, SmallVectorImpl<Function *> &Clones,
   return Shape;
 }
 
-static void updateCallGraphAfterCoroutineSplit(
+static LazyCallGraph::SCC &updateCallGraphAfterCoroutineSplit(
     LazyCallGraph::Node &N, const coro::Shape &Shape,
     const SmallVectorImpl<Function *> &Clones, LazyCallGraph::SCC &C,
     LazyCallGraph &CG, CGSCCAnalysisManager &AM, CGSCCUpdateResult &UR,
     FunctionAnalysisManager &FAM) {
----------------
yuxuanchen1997 wrote:

```
$ rg "updateCGAndAnalysisManagerFor(Function|CGSCC)?Pass"
llvm/unittests/Analysis/CGSCCPassManagerTest.cpp
1212:            updateCGAndAnalysisManagerForFunctionPass(CG, C, H2N, AM, UR, FAM);
1258:            updateCGAndAnalysisManagerForFunctionPass(CG, C, H2N, AM, UR, FAM);
1370:            updateCGAndAnalysisManagerForCGSCCPass(CG, C, H2N, AM, UR, FAM));
1407:        updateCGAndAnalysisManagerForFunctionPass(CG, C, H2N, AM, UR, FAM),
1438:            updateCGAndAnalysisManagerForCGSCCPass(CG, C, FN, AM, UR, FAM));
1469:        updateCGAndAnalysisManagerForFunctionPass(CG, C, FN, AM, UR, FAM),
1508:            updateCGAndAnalysisManagerForCGSCCPass(CG, C, FN, AM, UR, FAM));
1545:    ASSERT_DEATH(updateCGAndAnalysisManagerForCGSCCPass(CG, C, FN, AM, UR, FAM),
1777:              updateCGAndAnalysisManagerForCGSCCPass(CG, C, *N, AM, UR, FAM))
1867:          updateCGAndAnalysisManagerForCGSCCPass(CG, C, *N, AM, UR, FAM))
1923:        // Check that updateCGAndAnalysisManagerForCGSCCPass() after
1925:        updateCGAndAnalysisManagerForCGSCCPass(CG, *CG.lookupSCC(*N1), *N1, AM,
1987:          updateCGAndAnalysisManagerForCGSCCPass(CG, C, *N, AM, UR, FAM))

llvm/lib/Transforms/Utils/CallGraphUpdater.cpp
68:    updateCGAndAnalysisManagerForCGSCCPass(*LCG, *C, N, *AM, *UR, *FAM);

llvm/lib/Transforms/IPO/Inliner.cpp
497:    C = &updateCGAndAnalysisManagerForCGSCCPass(CG, *C, N, AM, UR, FAM);

llvm/lib/Transforms/Coroutines/CoroSplit.cpp
2108:    updateCGAndAnalysisManagerForCGSCCPass(CG, C, N, AM, UR, FAM);
2114:  updateCGAndAnalysisManagerForFunctionPass(CG, C, N, AM, UR, FAM);

llvm/lib/Analysis/CGSCCPassManager.cpp
561:      CurrentC = &updateCGAndAnalysisManagerForFunctionPass(CG, *CurrentC, *N,
876:static LazyCallGraph::SCC &updateCGAndAnalysisManagerForPass(
925:        // promoted before updateCGAndAnalysisManagerForPass runs.
1178:LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForFunctionPass(
1182:  return updateCGAndAnalysisManagerForPass(G, InitialC, N, AM, UR, FAM,
1185:LazyCallGraph::SCC &llvm::updateCGAndAnalysisManagerForCGSCCPass(
1189:  return updateCGAndAnalysisManagerForPass(G, InitialC, N, AM, UR, FAM,

llvm/include/llvm/Analysis/CGSCCPassManager.h
419:LazyCallGraph::SCC &updateCGAndAnalysisManagerForFunctionPass(
430:LazyCallGraph::SCC &updateCGAndAnalysisManagerForCGSCCPass(
```
This is manageable refactoring I'd say. Let's do this in a separate patch. 

https://github.com/llvm/llvm-project/pull/107935


More information about the llvm-commits mailing list