Share object maps in value_sett::make_union when destination is empty#9125
Open
tautschnig wants to merge 1 commit into
Open
Share object maps in value_sett::make_union when destination is empty#9125tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
The object_mapt representation is reference counted precisely so that multiple owners can share one map, yet make_union built the union element by element even when the destination was empty. Value-set queries for a single symbol (via get_value_set_rec) arrive here with an empty destination, so each such query copied the symbol's entire object map, including one std::optional<exprt> offset per element. Sharing the source map instead makes this constant time and removes the dominant allocation churn from value-set queries in symbolic execution. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
tautschnig
requested review from
kroening,
martin-cs and
peterschrammel
as code owners
July 22, 2026 09:10
There was a problem hiding this comment.
Pull request overview
This PR improves pointer-analysis value-set performance by avoiding element-by-element copying in value_sett::make_union when the destination map is empty. It leverages the existing copy-on-write reference_counting<> representation to share the underlying object map in constant time, reducing allocation churn during frequent single-symbol value-set queries in symbolic execution.
Changes:
- Early-return when the source object map is empty.
- When the destination object map is empty, assign
dest = srcto share the reference-counted representation instead of inserting entries one-by-one.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #9125 +/- ##
========================================
Coverage 80.83% 80.83%
========================================
Files 1715 1715
Lines 189948 189951 +3
Branches 73 73
========================================
+ Hits 153540 153543 +3
Misses 36408 36408 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
The object_mapt representation is reference counted precisely so that multiple owners can share one map, yet make_union built the union element by element even when the destination was empty. Value-set queries for a single symbol (via get_value_set_rec) arrive here with an empty destination, so each such query copied the symbol's entire object map, including one std::optional offset per element. Sharing the source map instead makes this constant time and removes the dominant allocation churn from value-set queries in symbolic execution.