Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/pointer-analysis/value_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,20 @@ bool value_sett::make_union_would_change(

bool value_sett::make_union(object_mapt &dest, const object_mapt &src) const
{
if(src.read().empty())
return false;

// If the destination is empty we can just share the (reference-counted)
// representation of `src` instead of inserting elements one by one. Queries
// over a single symbol repeatedly arrive here with an empty destination, so
// this turns an operation that is linear in the size of the value set (with
// all the allocation work that entails) into a constant-time one.
if(dest.read().empty())
{
dest = src;
return true;
}

bool result=false;

for(object_map_dt::const_iterator it=src.read().begin();
Expand Down
Loading