Skip to content

Commit 7355c60

Browse files
committed
[ML Inliner] Fix inconsistancy between CallGraph and FunctionLevels
When building our internal code, one of the function annotated with `co_await` (c++20) will cause inconsistancy: The function exists in CG but not FunctionLevels. This patch fixes it by using FunctionLevels only. Signed-off-by: Peter Rong <[email protected]>
1 parent 7d8b4eb commit 7355c60

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

llvm/lib/Analysis/MLInlineAdvisor.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,9 @@ MLInlineAdvisor::MLInlineAdvisor(
189189
}
190190

191191
unsigned MLInlineAdvisor::getInitialFunctionLevel(const Function &F) const {
192-
return CG.lookup(F) ? FunctionLevels.at(CG.lookup(F)) : 0;
192+
return FunctionLevels.find(CG.lookup(F)) != FunctionLevels.end()
193+
? FunctionLevels.at(CG.lookup(F))
194+
: 0;
193195
}
194196

195197
void MLInlineAdvisor::onPassEntry(LazyCallGraph::SCC *CurSCC) {

0 commit comments

Comments
 (0)