Skip to content

Don't simplify guard to skip instructions #4307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

smowton
Copy link
Contributor

@smowton smowton commented Mar 1, 2019

This still applies even with the guards-are-BDDs branch, since it retains the option to use expr-guards. Needs data, of course, but anecdotally this reduces symex time on one large Java example from about 20 to about 15 minutes.

Underlying theory: forward-GOTOs on a must-execute path (i.e. one that post-dominates the entry point) are rarer than forward-GOTOs that don't post-dominate, and the cost of figuring out that the guard must be effectively TRUE by checking goto_state_map for each intervening instruction is quite low (each instruction does a single map lookup to determine there is no incoming state to merge, checks state.guard.is_false() and continues). This is especially true for short GOTOs, which are also common. This simplify-and-jump code could only make a big saving when (a) the GOTO post-doms the entry point, (b) the state guard simplifies to true, and (c) the GOTO is long enough that the cost of a quick check-and-skip for each intervening instruction is high.

Which is cheaper: simplifying a large guard, or checking that goto_state_map
doesn't contain any incoming entries for the instructions between this one and
the jump target? My theory: the latter.
Copy link
Contributor

@romainbrenguier romainbrenguier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have some data to back-up your claims, but it doesn't break correctness.

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️
Passed Diffblue compatibility checks (cbmc commit: 4a3fa35).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/102807209

@tautschnig tautschnig merged commit f5483b2 into diffblue:develop Mar 1, 2019
@smowton
Copy link
Contributor Author

smowton commented Mar 1, 2019

Heh, okay, I won't benchmark it ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants