[llvm] [Coroutines][LazyCallGraph] resumes are not really SCC (PR #116285)

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 22 17:07:13 PST 2025


================
@@ -1720,6 +1720,7 @@ void LazyCallGraph::addSplitRefRecursiveFunctions(
   for (Function *NewFunction : NewFunctions) {
     Node &NewN = initNode(*NewFunction);
 
+    // Make the original function reference each new function
----------------
aeubanks wrote:

I think I'm confused based on the description and the previous discussion. Are you planning on first creating all the split functions in full (referencing each other), then one by one simplify-cfg each one, or are you planning on simplifying the cfg as you clone, meaning there's never actually a point where we have a fully connected RefSCC? The discussion above seems to imply the former, and the PR description seems to imply the latter.

If it's the former, then something like

```
coroSplit(Function& F, LazyCallGraph& LCG) {
  std::vector<Function *> SplitFunctions = doSplit(F);
  LCG.addSplitRefRecursiveFunctions(F, SplitFunctions);
  for (Function& NewF: SplitFunctions) {
    runSimplifyCfg(NewF);
    updateCGAndAnalysisManagerForFunctionPass(LCG, NewF);
    // updateCGAndAnalysisManagerForFunctionPass handles all possible transformations done by simplify-cfg
    // updateCGAndAnalysisManagerForCGSCCPass is not necessary since we only did function pass transformations since the last LCG update
  }
}
```

is simple and should work.

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


More information about the llvm-commits mailing list