Skip to content

Commit

Permalink
Consistently disable simplify_exprt::local_replace_map
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tautschnig committed Apr 15, 2018
1 parent da63652 commit 3c23b28
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/util/simplify_expr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,7 @@ bool simplify_exprt::simplify_if_preorder(if_exprt &expr)
result=false;
}

#if 0
#ifdef USE_LOCAL_REPLACE_MAP
replace_mapt map_before(local_replace_map);

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

local_replace_map.swap(map_before);
#else
#else
result=simplify_rec(truevalue) && result;
result=simplify_rec(falsevalue) && result;
#endif
#endif
}
else
{
Expand Down Expand Up @@ -2382,6 +2382,7 @@ bool simplify_exprt::simplify_rec(exprt &expr)
if(!simplify_node(tmp))
result=false;

#ifdef USE_LOCAL_REPLACE_MAP
#if 1
replace_mapt::const_iterator it=local_replace_map.find(tmp);
if(it!=local_replace_map.end())
Expand All @@ -2397,6 +2398,7 @@ bool simplify_exprt::simplify_rec(exprt &expr)
result=false;
}
#endif
#endif

if(!result)
{
Expand Down
5 changes: 5 additions & 0 deletions src/util/simplify_expr_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Author: Daniel Kroening, [email protected]

#include "type.h"
#include "mp_arith.h"
// #define USE_LOCAL_REPLACE_MAP
#ifdef USE_LOCAL_REPLACE_MAP
#include "replace_expr.h"
#endif

class bswap_exprt;
class byte_extract_exprt;
Expand Down Expand Up @@ -154,7 +157,9 @@ class simplify_exprt
#ifdef DEBUG_ON_DEMAND
bool debug_on;
#endif
#ifdef USE_LOCAL_REPLACE_MAP
replace_mapt local_replace_map;
#endif
};

#endif // CPROVER_UTIL_SIMPLIFY_EXPR_CLASS_H

0 comments on commit 3c23b28

Please sign in to comment.