Skip to content

[CONTRACTS] DFCC loop assigns infererence with functions inlined - #8490

Merged
qinheping merged 2 commits into
diffblue:developfrom
qinheping:DFCC_loop_assigns_infer
Nov 5, 2024
Merged

[CONTRACTS] DFCC loop assigns infererence with functions inlined#8490
qinheping merged 2 commits into
diffblue:developfrom
qinheping:DFCC_loop_assigns_infer

Conversation

@qinheping

@qinhepingqinheping commented Oct 31, 2024

Copy link
Copy Markdown
Collaborator

Current loop assigns inference of DFCC can only infer targets considering only instructions in the same function. However, variables may be written to in the call of another function from function call inside the loop. So in this PR, we infer loop assigns based on a copy of the function and inlining all calls in the copy.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@qinheping
qinhepingforce-pushed the DFCC_loop_assigns_infer branch 2 times, most recently from 9343bb6 to 09a3899CompareOctober 31, 2024 15:24
@codecov

codecovBot commented Oct 31, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 84.69388% with 15 lines in your changes missing coverage. Please review.

Project coverage is 78.80%. Comparing base (018c61c) to head (0444fad).

Files with missing linesPatch %Lines
...ntracts/dynamic-frames/dfcc_infer_loop_assigns.cpp84.70%13 Missing ⚠️
...trument/contracts/dynamic-frames/dfcc_cfg_info.cpp84.61%2 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## develop #8490 +/- ##
===========================================
- Coverage 78.90% 78.80% -0.11% 
===========================================
Files 1727 1727 Lines 198425 198785 +360 Branches 18523 18529 +6 ===========================================
+ Hits 156561 156643 +82 - Misses 41864 42142 +278 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@qinheping
qinhepingforce-pushed the DFCC_loop_assigns_infer branch from 09a3899 to 45d7ad7CompareNovember 1, 2024 06:37
@feliperodrifeliperodri added the Code Contracts Function and loop contracts label Nov 2, 2024
@qinheping
qinhepingforce-pushed the DFCC_loop_assigns_infer branch 6 times, most recently from cea198b to 0444fadCompareNovember 5, 2024 06:34
@qinheping

Copy link
Copy Markdown
CollaboratorAuthor

We also switch to a more aggressive loop-assigns widening strategy that also widens all dereference to whole object. The reason to do so is that it fits better for Kani loop contracts, while we have a good loop assigns specification support for C loop contracts for which the inference is less needed.


for(unsigned i = 0; i < SIZE; i++)
__CPROVER_loop_invariant(i <= SIZE)
__CPROVER_assigns(data[1], i) __CPROVER_loop_invariant(i <= SIZE)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this change now strictly necessary given the additional widening?

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

Yes, new addition widening will infer object_whole(data), i which is not accurate for this test.

Comment threadsrc/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp Outdated
Comment threadsrc/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp Outdated
Comment threadsrc/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp Outdated
Comment threadsrc/goto-instrument/contracts/dynamic-frames/dfcc_infer_loop_assigns.cpp Outdated
@qinheping
qinhepingforce-pushed the DFCC_loop_assigns_infer branch from 0444fad to 0b7047fCompareNovember 5, 2024 15:27
@qinheping
qinhepingforce-pushed the DFCC_loop_assigns_infer branch from 0b7047f to 2317524CompareNovember 5, 2024 15:38
@qinheping
qinheping merged commit f5f0672 into diffblue:developNov 5, 2024
@qinheping
qinheping deleted the DFCC_loop_assigns_infer branch November 5, 2024 16:10
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code ContractsFunction and loop contracts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@qinheping@tautschnig@feliperodri