Skip to content

Commit 04ad940

Browse files
smowtontautschnig
authored andcommitted
Symex-dereference: simplify after deref
This is generally useful because it turns member-of-if into if-of-member, which avoids repeatedly quoting large complex if expressions in a with_exprt, but it is especially good for field sensitivity as it puts member expressions directly on top of symbol expressions, which field sensitivity knows how to deal with.
1 parent 9ab104b commit 04ad940

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/goto-symex/symex_dereference.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -404,5 +404,14 @@ void goto_symext::dereference(
404404
// dereferencing may introduce new symbol_exprt
405405
// (like __CPROVER_memory)
406406
state.rename(expr, ns, goto_symex_statet::L1);
407+
408+
// dereferencing is likely to introduce new member-of-if constructs --
409+
// for example, "x->field" may have become "(x == &o1 ? o1 : o2).field"
410+
// Simplify (which converts that to (x == &o1 ? o1.field : o2.field)) before
411+
// applying field sensitivity, which can turn such field-of-symbol expressions
412+
// into atomic SSA expressions, but would have to rewrite all of 'o1'
413+
// otherwise.
414+
do_simplify(expr);
415+
407416
field_sensitivityt::apply(ns, expr, write, state);
408417
}

0 commit comments

Comments
 (0)