Skip to content

Commit d145bda

Browse files
committed
Merge 'if new_guard == true' blocks
This means that the symex_transition call is duplicated, but better that one call than multiple if statements.
1 parent 5054f03 commit d145bda

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/goto-symex/symex_goto.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -211,26 +211,23 @@ void goto_symext::symex_goto(statet &state)
211211
framet::goto_state_listt &goto_state_list =
212212
state.call_stack().top().goto_state_map[new_state_pc];
213213

214-
// If the guard is true (and the alternative branch unreachable) we can move
215-
// the state in this case as it'll never be accessed on the alternate branch.
214+
// If the guard is unconditionally true it means the alternative branch is
215+
// unreachable. In that case, move the state onto the state list, transition,
216+
// and set the current guard to false.
216217
if(new_guard.is_true())
217218
{
218219
goto_state_list.emplace_back(state, true);
219-
}
220-
else
221-
{
222-
goto_state_list.emplace_back(state);
223-
}
224220

225-
symex_transition(state, state_pc, backward);
221+
symex_transition(state, state_pc, backward);
226222

227-
// adjust guards
228-
if(new_guard.is_true())
229-
{
230223
state.guard = guardt(false_exprt());
231224
}
232225
else
233226
{
227+
goto_state_list.emplace_back(state);
228+
229+
symex_transition(state, state_pc, backward);
230+
234231
// produce new guard symbol
235232
exprt guard_expr;
236233

0 commit comments

Comments
 (0)