Skip to content

Commit 3c23b28

Browse files
committed
Consistently disable simplify_exprt::local_replace_map
This avoids unnecessarily computing the hash of an exprt for an unused map. The common preprocessor macro now also links together all related bits of code.
1 parent da63652 commit 3c23b28

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/util/simplify_expr.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,7 @@ bool simplify_exprt::simplify_if_preorder(if_exprt &expr)
10671067
result=false;
10681068
}
10691069

1070-
#if 0
1070+
#ifdef USE_LOCAL_REPLACE_MAP
10711071
replace_mapt map_before(local_replace_map);
10721072

10731073
// a ? b : c --> a ? b[a/true] : c
@@ -1109,10 +1109,10 @@ bool simplify_exprt::simplify_if_preorder(if_exprt &expr)
11091109
result=simplify_rec(falsevalue) && result;
11101110

11111111
local_replace_map.swap(map_before);
1112-
#else
1112+
#else
11131113
result=simplify_rec(truevalue) && result;
11141114
result=simplify_rec(falsevalue) && result;
1115-
#endif
1115+
#endif
11161116
}
11171117
else
11181118
{
@@ -2382,6 +2382,7 @@ bool simplify_exprt::simplify_rec(exprt &expr)
23822382
if(!simplify_node(tmp))
23832383
result=false;
23842384

2385+
#ifdef USE_LOCAL_REPLACE_MAP
23852386
#if 1
23862387
replace_mapt::const_iterator it=local_replace_map.find(tmp);
23872388
if(it!=local_replace_map.end())
@@ -2397,6 +2398,7 @@ bool simplify_exprt::simplify_rec(exprt &expr)
23972398
result=false;
23982399
}
23992400
#endif
2401+
#endif
24002402

24012403
if(!result)
24022404
{

src/util/simplify_expr_class.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Author: Daniel Kroening, [email protected]
1919

2020
#include "type.h"
2121
#include "mp_arith.h"
22+
// #define USE_LOCAL_REPLACE_MAP
23+
#ifdef USE_LOCAL_REPLACE_MAP
2224
#include "replace_expr.h"
25+
#endif
2326

2427
class bswap_exprt;
2528
class byte_extract_exprt;
@@ -154,7 +157,9 @@ class simplify_exprt
154157
#ifdef DEBUG_ON_DEMAND
155158
bool debug_on;
156159
#endif
160+
#ifdef USE_LOCAL_REPLACE_MAP
157161
replace_mapt local_replace_map;
162+
#endif
158163
};
159164

160165
#endif // CPROVER_UTIL_SIMPLIFY_EXPR_CLASS_H

0 commit comments

Comments
 (0)