mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
fix for AST optimization altering top-level body statement
This commit is contained in:
parent
22af54dda2
commit
143d306883
3 changed files with 17 additions and 5 deletions
|
@ -130,13 +130,19 @@ void optimize_func(ScriptFunc* f, std::shared_ptr<ProfileFunc> pf,
|
|||
|
||||
rc->SetDefSetsMgr(reduced_rds.GetDefSetsMgr());
|
||||
|
||||
auto ud = std::make_unique<UseDefs>(body, rc);
|
||||
auto ud = std::make_shared<UseDefs>(body, rc);
|
||||
ud->Analyze();
|
||||
|
||||
if ( analysis_options.dump_uds )
|
||||
ud->Dump();
|
||||
|
||||
ud->RemoveUnused();
|
||||
new_body = ud->RemoveUnused();
|
||||
|
||||
if ( new_body != body )
|
||||
{
|
||||
f->ReplaceBody(body, new_body);
|
||||
body = new_body;
|
||||
}
|
||||
|
||||
int new_frame_size =
|
||||
scope->Length() + rc->NumTemps() + rc->NumNewLocals();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue