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

Yuxuan Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 20:57:54 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:

Actually, I can't. It's not just to keep it consistent with the semantics of `updateCGAndAnalysisManagerForCGSCCPass`. The `LazyCallGraph::SCC &C` is an lvalue ref and cannot be rebound. If I do `C = update...` it will invoke the Move Assignment operator for `LazyCallGraph::SCC`. Not sure the consequence will be intended. 

My other option is to make this input a `LazyCallGraph::SCC **` or `LazyCallGraph::SCC *&`, which is also not very obvious. 

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


More information about the llvm-commits mailing list