Skip to content

Commit 6f940ce

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 2f176ac commit 6f940ce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/goto-symex/symex_dereference.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,4 +389,12 @@ void goto_symext::dereference(
389389
// dereferencing may introduce new symbol_exprt
390390
// (like __CPROVER_memory)
391391
state.rename(expr, ns, goto_symex_statet::L1);
392+
393+
// dereferencing is likely to introduce new member-of-if constructs --
394+
// for example, "x->field" may have become "(x == &o1 ? o1 : o2).field"
395+
// Simplify (which converts that to (x == &o1 ? o1.field : o2.field)) before
396+
// applying field sensitivity, which can turn such field-of-symbol expressions
397+
// into atomic SSA expressions, but would have to rewrite all of 'o1'
398+
// otherwise.
399+
do_simplify(expr);
392400
}

0 commit comments

Comments
 (0)