Repository navigation
DFCC: skip loop assigns inference when no loop needs it - #9582
Open
Kieran-Hulsman wants to merge 1 commit into
Open
Kieran-Hulsman wants to merge 1 commit into
Kieran-Hulsman wants to merge 1 commit into
Conversation
The inferred loop assigns are only used for loops that have a contract but no assigns clause, yet dfcc_cfg_infot ran the inference for every function with a loop contract. The inference inlines all callees and computes dominators, so its cost is quadratic in the inlined size. Only run it when some loop needs it. The instrumented program does not change. On a synthetic loop that reaches 12000 instructions, goto-instrument goes from 19.9 s and 3.7 GB to 9.9 s and 254 MB.
Kieran-Hulsman
requested review from
feliperodri,
kroening,
peterschrammel,
remi-delmas-3000 and
tautschnig
as code owners
November 28, 2026 15:32
4 tasks done
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #9582 +/- ##
===========================================
+ Coverage 81.28% 81.32% +0.03%
===========================================
Files 1725 1726 +1
Lines 191618 191741 +123
Branches 73 73
===========================================
+ Hits 155763 155936 +173
+ Misses 35855 35805 -50 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
DFCC runs the loop assigns inference for every function with a loop contract, but only uses the result for loops without an assigns clause. The inference inlines every callee, so it gets expensive quickly. This skips it when every loop with a contract already has an assigns clause. The instrumented program doesn't change (same
--show-goto-functionsoutput on the inputs below).I discovered this while writing model-checking/verify-rust-std#758. Kani always emits loop assigns clauses, so it pays for the inference without using it. On the
BinaryHeapharnesses there, goto-instrument 6.11.0 ran out of memory or needed up to 14 GB. With this patch, none needs more than 142 MB. This may also be the cause of model-checking/kani#4967.loop_assigns_inference-all-explicitchecks that the inference is skipped, and-mixedand-mixed-failcheck that it still runs when only some loops have an assigns clause.goto-instrument on develop (
cf12e35b):BinaryHeap::sift_up-style loop with-Z valid-value-checks