mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
ZAM control-flow tracking now explicitly includes the ends of loops
This commit is contained in:
parent
b0e21b7e64
commit
56d01ea83b
4 changed files with 24 additions and 5 deletions
|
@ -1031,6 +1031,23 @@ void ZAMCompiler::KillInst(zeek_uint_t i) {
|
|||
insts1[j]->aux->cft[CFT_BLOCK_END] += be_cnt;
|
||||
}
|
||||
|
||||
if ( cft.count(CFT_LOOP_END) > 0 ) {
|
||||
// Propagate block-ends backwards.
|
||||
int j = i;
|
||||
while ( --j >= 0 )
|
||||
if ( insts1[j]->live )
|
||||
break;
|
||||
|
||||
ASSERT(j >= 0);
|
||||
|
||||
// Make sure the CFT entry is created.
|
||||
AddCFT(insts1[j], CFT_LOOP_END);
|
||||
|
||||
auto le_cnt = cft[CFT_LOOP_END];
|
||||
--le_cnt; // we already did one above
|
||||
insts1[j]->aux->cft[CFT_LOOP_END] += le_cnt;
|
||||
}
|
||||
|
||||
// If's can be killed because their bodies become empty,
|
||||
// break's because they just lead to their following instruction,
|
||||
// and next's if they become dead code.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue