Reduce var_eq witness invariants from quadratic to linear #1826
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@karoliineh found that for ldv-linux-3.4-simple/32_1_cilled_ok_nondet_linux-3.4-32_1-drivers--block--paride--on26.ko-ldv_main0_sequence_infinite_withcheck_stateful.cil.out in sv-benchmarks we output tens of thousands of invariants into the YAML witness. As of current
master
, 43083 loop invariants to be exact.Most of them seemed to be equalities between
__cil_tmp
variables which are actually in the program (because it is cilled), not introduced by us, so it's not the filtering of temporaries at fault.Instead, these equalities come from large
var_eq
equality clusters because there are many of those variables pulled up to function level, so all of the equalities are in scope in many points in large functions.The current
var_eq
invariant generation is not that great: it outputs a quadratic number of pairwise equalities from a cluster (only deduplicating by reflexivity and symmetry). Arguably, this is very redundant: we shouldn't have to make transitivity explicit.Therefore, this PR changes
var_eq
invariant generation to output a linear number of equalities with a single element from the cluster, the rest follow by transitivity implicitly.For the SV-COMP task above, we now only output 859 loop invariants!
We no longer OOM when trying to validate our own witness to this task. However, we also don't confirm it yet because of #1710.