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
10 changes: 10 additions & 0 deletions src/util/irep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,16 @@ bool irept::ordering(const irept &other) const
/// comments are ignored
int irept::compare(const irept &i) const
{
// Fast path: structurally-shared instances compare equal in O(1).
// Without this, dictionaries / std::map<exprt> walk the entire
// sub-tree even when both keys point to the same node — this is
// a hot path under heavy SMT struct flattening (smt2_convt's
// defined_expressions / datatype_map lookups).
#ifdef SHARING
if(data == i.data)
return 0;
#endif

int r;

r=id().compare(i.id());
Expand Down
Loading