some minor ZAM optimization improvements

This commit is contained in:
Vern Paxson 2023-11-05 16:33:19 -08:00 committed by Arne Welzel
parent fadda05782
commit e3b75ac391
4 changed files with 68 additions and 0 deletions

View file

@ -228,6 +228,14 @@ bool ZAMCompiler::PruneUnused() {
continue;
}
if ( i == insts1.size() - 1 && inst->op == OP_RETURN_X ) {
// A non-value return at the very end of the body
// doesn't actually do anything.
did_prune = true;
KillInst(i);
continue;
}
if ( inst->IsLoad() && ! VarIsUsed(inst->v1) ) {
did_prune = true;
KillInst(i);