Skip to content

Commit 9331a61

Browse files
committed
[Coroutines] Updated with reviewer feedback
1 parent e360642 commit 9331a61

File tree

2 files changed

+9
-23
lines changed

2 files changed

+9
-23
lines changed

llvm/include/llvm/Analysis/LazyCallGraph.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,12 +1081,15 @@ class LazyCallGraph {
10811081

10821082
/// Add new ref-recursive functions split/outlined from an existing function.
10831083
///
1084-
/// The new functions may only reference the original function or other
1085-
/// functions that the original function did. New functions must not call
1086-
/// other new functions.
1084+
/// The new functions may only reference other functions that the original
1085+
/// function did. The new functions may reference the original function. New
1086+
/// functions must not call other new functions or the original function.
10871087
///
1088-
/// Mark the original function as referencing all new functions.
1089-
/// Mark all new functions as referencing each other.
1088+
/// Marks the original function as referencing all new functions.
1089+
///
1090+
/// The CG must be updated following the use of this helper, for example with
1091+
/// updateCGAndAnalysisManagerForCGSCCPass(), to ensure the RefSCCs and SCCs
1092+
/// are correctly identified.
10901093
void addSplitRefRecursiveFunctions(Function &OriginalFunction,
10911094
ArrayRef<Function *> NewFunctions);
10921095

llvm/lib/Analysis/LazyCallGraph.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,23 +1733,6 @@ void LazyCallGraph::addSplitRefRecursiveFunctions(
17331733
}
17341734
}
17351735

1736-
for (Function *NewFunction : NewFunctions) {
1737-
Node &NewN = get(*NewFunction);
1738-
for (Function *OtherNewFunction : NewFunctions) {
1739-
if (NewFunction == OtherNewFunction)
1740-
continue;
1741-
1742-
Node &OtherNewN = get(*OtherNewFunction);
1743-
1744-
// Don't add an edge if one already exists.
1745-
if (NewN->lookup(OtherNewN))
1746-
continue;
1747-
1748-
// Make the new function reference each other new function
1749-
NewN->insertEdgeInternal(OtherNewN, Edge::Kind::Ref);
1750-
}
1751-
}
1752-
17531736
RefSCC *NewRC;
17541737
if (ExistsRefToOriginalRefSCC) {
17551738
// If there is any edge from any new function to any function in the
@@ -1793,7 +1776,7 @@ void LazyCallGraph::addSplitRefRecursiveFunctions(
17931776
if (F1 == F2)
17941777
continue;
17951778
Node &N2 = get(*F2);
1796-
assert(N1->lookup(N2) &&
1779+
assert(!N1->lookup(N2) ||
17971780
(!N1->lookup(N2)->isCall() &&
17981781
"Edges between new functions must be ref edges"));
17991782
}

0 commit comments

Comments
 (0)