Skip to content

Commit d820e89

Browse files
committed
Simplify guards/conditions before storing them in the equation
We should use the most canonical form to facilitate efficient encodings in the back-end.
1 parent 50080d8 commit d820e89

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/goto-symex/symex_goto.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ void goto_symext::symex_goto(statet &state)
247247
symbol_exprt guard_symbol_expr =
248248
symbol_exprt(statet::guard_identifier(), bool_typet());
249249
exprt new_rhs = boolean_negate(new_guard);
250+
do_simplify(new_rhs);
250251

251252
ssa_exprt new_lhs(guard_symbol_expr);
252253
state.rename(new_lhs, ns, goto_symex_statet::L1);
@@ -267,8 +268,8 @@ void goto_symext::symex_goto(statet &state)
267268
original_source,
268269
symex_targett::assignment_typet::GUARD);
269270

270-
guard_expr = boolean_negate(guard_symbol_expr);
271-
state.rename(guard_expr, ns);
271+
state.rename(new_lhs, ns);
272+
guard_expr = boolean_negate(new_lhs);
272273
}
273274

274275
if(state.has_saved_jump_target)

src/goto-symex/symex_main.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ void goto_symext::vcc(
103103

104104
state.guard.guard_expr(expr);
105105

106+
// It would be nice to simplify again to canoncialize the combined guard +
107+
// condition expression, but this causes excessive SAT solver runtime on
108+
// jbmc/regression/jbmc-strings/StringIndexOf, raising the solver execution
109+
// time from 0.004s to 162 seconds.
110+
// do_simplify(expr);
111+
106112
state.remaining_vccs++;
107113
target.assertion(state.guard.as_expr(), expr, msg, state.source);
108114
}

0 commit comments

Comments
 (0)