Skip to content

Commit

Permalink
ParseAPI: improve tail call recognition (#1315)
Browse files Browse the repository at this point in the history
Don't consider a branch that is a self-loop as a potential tail call.
  • Loading branch information
jmellorcrummey committed Nov 11, 2022
1 parent 55848b7 commit bf14405
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions parseAPI/src/Parser.C
Original file line number Diff line number Diff line change
Expand Up @@ -918,9 +918,11 @@ Parser::finalize(Function *f)
b->copy_targets(targets);
for (auto e : targets) {
if (!e->interproc() && (e->type() == INDIRECT || e->type() == DIRECT)) {
if (b->last() != e->trg()->start()) { // if not an instruction that branches to itself
e->_type._interproc = true;
parsing_printf("from %lx to %lx, marked as tail call (jump at entry), re-finalize\n", b->last(), e->trg()->start());
return false;
}
}
}
}
Expand Down

0 comments on commit bf14405

Please sign in to comment.