mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
fixed incorrect ZAM optimization of expressions seen in single-statement inlined functions
This commit is contained in:
parent
8054547712
commit
d2762fb247
3 changed files with 43 additions and 4 deletions
|
@ -92,11 +92,18 @@ TraversalCode GenIDDefs::PreStmt(const Stmt* s) {
|
|||
st->Traverse(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
// If there's just a single statement then there are no
|
||||
// expressions computed subsequent to it that we need to
|
||||
// worry about, so just do ordinary traversal.
|
||||
else {
|
||||
// If there's just a single statement then there are two
|
||||
// possibilities. If the statement is atomic (no sub-statements)
|
||||
// then given that it's in reduced form, it's not going to have
|
||||
// any expressions that we can leverage. OTOH, if it's compound
|
||||
// (if/for/while/switch) then there's no safe re-using of
|
||||
// expressions within it since they may-or-may-not wind up
|
||||
// being computed. So we should always start a new block.
|
||||
StartConfluenceBlock(s);
|
||||
did_confluence = true;
|
||||
block->Traverse(this);
|
||||
}
|
||||
|
||||
if ( did_confluence )
|
||||
EndConfluenceBlock();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue