Skip to content

Commit 3d46af3

Browse files
committed
Erase dead values from the value-set
This saves memory while achieving very similar behaviour as a read from a value removed from the value-set still yields a failed object. The difference is what happens on a merge: a merge with an explicit failed object retains it, while a merge against an empty value-set will discard the undefined possibility. This is fine for dead variables, where on a control- flow convergance we may safely assume we came from the path where it is not dead, but for declarations and undefined extern variables the front-end and goto-symex must collaborate to ensure an explicit nondet value is present.
1 parent 46ba4e7 commit 3d46af3

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/goto-symex/symex_dead.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,13 @@ void goto_symext::symex_dead(statet &state)
2222
const code_deadt &code = instruction.get_dead();
2323

2424
ssa_exprt ssa = state.rename_ssa<L1>(ssa_exprt{code.symbol()}, ns);
25-
26-
// in case of pointers, put something into the value set
27-
if(code.symbol().type().id() == ID_pointer)
28-
{
29-
exprt rhs;
30-
if(auto failed = get_failed_symbol(to_symbol_expr(code.symbol()), ns))
31-
rhs = address_of_exprt(*failed, to_pointer_type(code.symbol().type()));
32-
else
33-
rhs=exprt(ID_invalid);
34-
35-
const exprt l1_rhs = state.rename<L1>(std::move(rhs), ns);
36-
state.value_set.assign(ssa, l1_rhs, ns, true, false);
37-
}
38-
3925
const irep_idt &l1_identifier = ssa.get_identifier();
4026

4127
// we cannot remove the object from the L1 renaming map, because L1 renaming
4228
// information is not local to a path, but removing it from the propagation
43-
// map is safe as 1) it is local to a path and 2) this instance can no longer
44-
// appear
29+
// map and value-set is safe as 1) it is local to a path and 2) this instance
30+
// can no longer appear
31+
state.value_set.values.erase(l1_identifier);
4532
state.propagation.erase(l1_identifier);
4633
// increment the L2 index to ensure a merge on join points will propagate the
4734
// value for branches that are still live

0 commit comments

Comments
 (0)