Skip to content

Commit 022846a

Browse files
author
Daniel Kroening
committed
letify: use irep_hash_mapt when hashing is expensive
Fixes: diffblue#344 Fixes: diffblue#1944
1 parent 9a0ffae commit 022846a

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

regression/cbmc/Float-smt2-1/main.c

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#include <assert.h>
2+
3+
int main (void) {
4+
float f;
5+
6+
assert(f * f > 28);
7+
8+
return 0;
9+
}
10+
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE smt-backend
2+
main.c
3+
--smt2
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
--
7+
Tests a floating-point operation encoding for SMT2 without --fpa.
8+
Owing to heavy use of sharing, this requires sharing-aware hashing.

src/solvers/smt2/smt2_conv.h

+9
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Author: Daniel Kroening, [email protected]
1616
#include <util/std_expr.h>
1717
#include <util/byte_operators.h>
1818

19+
#ifndef HASH_CODE
20+
#include <util/irep_hash_container.h>
21+
#endif
22+
1923
#include <solvers/prop/prop_conv.h>
2024
#include <solvers/flattening/boolbv_width.h>
2125
#include <solvers/flattening/pointer_logic.h>
@@ -181,7 +185,12 @@ class smt2_convt:public prop_convt
181185
symbol_exprt let_symbol;
182186
};
183187

188+
#ifdef HASH_CODE
184189
typedef std::unordered_map<exprt, let_count_idt, irep_hash> seen_expressionst;
190+
#else
191+
typedef irep_hash_mapt<exprt, let_count_idt> seen_expressionst;
192+
#endif
193+
185194
std::size_t let_id_count;
186195
static const std::size_t LET_COUNT = 2;
187196

0 commit comments

Comments
 (0)