speed up ZAM compilation by capping function size when inlining

This commit is contained in:
Vern Paxson 2022-05-14 14:52:31 -07:00
parent 0c2f04548a
commit 7d00ce0082
13 changed files with 79 additions and 14 deletions

View file

@ -718,6 +718,10 @@ void begin_func(IDPtr id, const char* module_name, FunctionFlavor flavor, bool i
if ( Attr* depr_attr = find_attr(current_scope()->Attrs().get(), ATTR_DEPRECATED) )
current_scope()->GetID()->MakeDeprecated(depr_attr->GetExpr());
// Reset the AST node statistics to track afresh for this function.
Stmt::ResetNumStmts();
Expr::ResetNumExprs();
}
class OuterIDBindingFinder : public TraversalCallback
@ -804,7 +808,10 @@ void end_func(StmtPtr body, bool free_of_conditionals)
// by duplicating can itself be correctly duplicated.
body = body->Duplicate()->Duplicate();
body->GetOptInfo()->is_free_of_conditionals = free_of_conditionals;
auto oi = body->GetOptInfo();
oi->is_free_of_conditionals = free_of_conditionals;
oi->num_stmts = Stmt::GetNumStmts();
oi->num_exprs = Expr::GetNumExprs();
auto ingredients = std::make_unique<function_ingredients>(pop_scope(), std::move(body));