-
Notifications
You must be signed in to change notification settings - Fork 278
Maintain loop invariant annotation when converting do .. while #8417
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
Maintain loop invariant annotation when converting do .. while #8417
Conversation
bfd5e66
to
612191a
Compare
60d7d4a
to
88d2091
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8417 +/- ##
===========================================
- Coverage 77.93% 77.88% -0.05%
===========================================
Files 1726 1726
Lines 189657 189804 +147
Branches 18255 18234 -21
===========================================
+ Hits 147805 147826 +21
- Misses 41852 41978 +126 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The do-while loop test can be made to work with x < 10
. in the invariant
@@ -7,3 +7,4 @@ main.c | |||
-- | |||
-- | |||
This test checks that loop contracts work correctly on do/while loops. | |||
Fails because contracts are not yet supported on do while loops. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Contracts are supported on do-while thanks to latch normalization, here you need to fix the loop invariant to 0 <= x && x < 10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed for the dfcc variant.
With the changes in bbd9de4 we newly made do .. while converted instructions subject to `optimize_guarded_gotos`, which previously rewrote conditions without retaining annotations related to loop invariants. The included tests now show that the annotations are preserved, but still fail for an unrelated bug in how do .. while loops are instrumented.
The incoming edge from a `goto` instruction may also be the non-branching case, which must not result in redirecting this goto.
88d2091
to
6009066
Compare
With the changes in bbd9de4 we newly made do .. while converted instructions subject to
optimize_guarded_gotos
, which previously rewrote conditions without retaining annotations related to loop invariants.