Skip to content
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

Optimize blocks #919

Merged
merged 51 commits into from
Aug 15, 2024
Merged

Conversation

keyboardDrummer
Copy link
Collaborator

@keyboardDrummer keyboardDrummer commented Jul 24, 2024

Changes

  1. Perform block coalescing for each split
  2. Add a post-split simplification that removes empty blocks with at most one outgoing or incoming edge

Testing

  • Updated the test AssumeFalseSplit.bpl to take into account simplification (2)

@shazqadeer
Copy link
Contributor

The block coalescing feature already exists in Boogie and appears to be on by default:

@keyboardDrummer
Copy link
Collaborator Author

The block coalescing feature already exists in Boogie and appears to be on by default:

Thanks. The coalescing I'm running happens for each split, after other optimizations which may enable more coalescing, so there is benefit in doing it again.

However, I've removed the duplicate coalescing implementation that this PR adds.

@keyboardDrummer keyboardDrummer mentioned this pull request Jul 25, 2024
@keyboardDrummer keyboardDrummer marked this pull request as ready for review August 13, 2024 12:16
atomb
atomb previously approved these changes Aug 15, 2024
Copy link
Collaborator

@atomb atomb left a comment

Choose a reason for hiding this comment

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

This looks good. None of my comments are blocking.

I have slight worries about soundness when doing transformations like this, though I don't see anything suspicious right away. For the moment, I think I trust the test suite (plus the Dafny test suite, once it's being used there) to detect potential bugs.

@@ -3497,7 +3497,7 @@ void ObjectInvariant()
{
Contract.Invariant(labelNames == null || labelTargets == null || labelNames.Count == labelTargets.Count);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

You've added some trailing whitespace here. I find that Rider is very eager to do this!

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is this change? A change in line ending?


namespace VCGeneration;

class OldBlockTransformations {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this used anywhere?

using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Threading.Tasks.Dataflow;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems like a very relevant library for this kind of task, but I don't actually see how it's used. Is it?

@keyboardDrummer keyboardDrummer merged commit b337ffc into boogie-org:master Aug 15, 2024
5 checks passed
@keyboardDrummer keyboardDrummer deleted the optimizeBlocks branch August 15, 2024 16:36
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.

3 participants