skip optimization of functions with AST nodes unknown to script optimization

This commit is contained in:
Vern Paxson 2024-11-29 16:12:05 -08:00
parent a2a47ba334
commit 35e157a0ab
7 changed files with 148 additions and 9 deletions

View file

@ -101,7 +101,7 @@ ProfileFunc::ProfileFunc(const Expr* e, bool _abs_rec_fields) {
}
TraversalCode ProfileFunc::PreStmt(const Stmt* s) {
stmts.push_back(s);
stmts.push_back({NewRef{}, const_cast<Stmt*>(s)});
switch ( s->Tag() ) {
case STMT_INIT:
@ -185,7 +185,7 @@ TraversalCode ProfileFunc::PreStmt(const Stmt* s) {
}
TraversalCode ProfileFunc::PreExpr(const Expr* e) {
exprs.push_back(e);
exprs.push_back({NewRef{}, const_cast<Expr*>(e)});
TrackType(e->GetType());
@ -867,11 +867,11 @@ void ProfileFuncs::ComputeProfileHash(std::shared_ptr<ProfileFunc> pf) {
h = merge_p_hashes(h, p_hash(ov[i]->Name()));
h = merge_p_hashes(h, p_hash("stmts"));
for ( auto i : pf->Stmts() )
for ( auto& i : pf->Stmts() )
h = merge_p_hashes(h, p_hash(i->Tag()));
h = merge_p_hashes(h, p_hash("exprs"));
for ( auto i : pf->Exprs() )
for ( auto& i : pf->Exprs() )
h = merge_p_hashes(h, p_hash(i->Tag()));
h = merge_p_hashes(h, p_hash("ids"));