3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-27 13:39:49 +00:00

cache is_shared information in the enode

observed perf overhead for QF_NIA is that assume_eqs in theory_lra incurs significant overhead when calling is_relevant_and_shared. The call to context::is_shared and the loop checking for beta redexes is a main bottleneck. The bottleneck is avoided by caching the result if is_shared inside the enode. It is invalidated for every merge/unmerge.
This commit is contained in:
Nikolaj Bjorner 2023-09-23 17:19:06 -07:00
parent eea9c0bec6
commit 61319ffd85
6 changed files with 58 additions and 6 deletions

View file

@ -77,6 +77,7 @@ namespace smt {
unsigned m_bool:1; //!< True if it is a boolean enode
unsigned m_merge_tf:1; //!< True if the enode should be merged with true/false when the associated boolean variable is assigned.
unsigned m_cgc_enabled:1; //!< True if congruence closure is enabled for this enode.
unsigned m_is_shared:2; //!< 0 - not shared, 1 - shared, 2 - invalid state
unsigned m_iscope_lvl; //!< When the enode was internalized
bool m_proof_is_logged; //!< Indicates that the proof for the enode being equal to its root is in the log.
signed char m_lbl_hash; //!< It is different from -1, if enode is used in a pattern
@ -179,6 +180,21 @@ namespace smt {
return m_owner->hash();
}
lbool is_shared() const {
switch (m_is_shared) {
case 0: return l_false;
case 1: return l_true;
default: return l_undef;
}
}
void set_is_shared(lbool s) {
switch (s) {
case l_true: m_is_shared = 1; break;
case l_false: m_is_shared = 0; break;
default: m_is_shared = 2; break;
}
}
enode * get_root() const {
return m_root;