|
16 | 16 | #include <util/exception_utils.h>
|
17 | 17 | #include <util/invariant.h>
|
18 | 18 | #include <util/pointer_offset_size.h>
|
| 19 | +#include <util/range.h> |
19 | 20 | #include <util/std_expr.h>
|
20 | 21 |
|
21 | 22 | #include <analyses/dirty.h>
|
@@ -357,26 +358,37 @@ void goto_symext::phi_function(
|
357 | 358 | const statet::goto_statet &goto_state,
|
358 | 359 | statet &dest_state)
|
359 | 360 | {
|
360 |
| - // go over all variables to see what changed |
361 |
| - std::unordered_set<ssa_exprt, irep_hash> variables; |
| 361 | + auto ssa_of_current_name = |
| 362 | + [&](const std::pair<irep_idt, std::pair<ssa_exprt, unsigned>> &pair) { |
| 363 | + return pair.second.first; |
| 364 | + }; |
| 365 | + |
| 366 | + auto dest_state_names_range = |
| 367 | + make_range(dest_state.level2.current_names) |
| 368 | + .filter( |
| 369 | + [&](const std::pair<irep_idt, std::pair<ssa_exprt, unsigned>> &pair) { |
| 370 | + // We ignore the identifiers that are already in goto_state names |
| 371 | + return goto_state.level2_current_names.count(pair.first) == 0; |
| 372 | + }) |
| 373 | + .map<const ssa_exprt>(ssa_of_current_name); |
362 | 374 |
|
363 |
| - goto_state.level2_get_variables(variables); |
364 |
| - dest_state.level2.get_variables(variables); |
| 375 | + // go over all variables to see what changed |
| 376 | + auto all_current_names_range = make_range(goto_state.level2_current_names) |
| 377 | + .map<const ssa_exprt>(ssa_of_current_name) |
| 378 | + .concat(dest_state_names_range); |
365 | 379 |
|
366 | 380 | guardt diff_guard;
|
367 |
| - |
368 |
| - if(!variables.empty()) |
| 381 | + if(!all_current_names_range.empty()) |
369 | 382 | {
|
370 | 383 | diff_guard=goto_state.guard;
|
371 | 384 |
|
372 | 385 | // this gets the diff between the guards
|
373 | 386 | diff_guard-=dest_state.guard;
|
374 | 387 | }
|
375 | 388 |
|
376 |
| - for(std::unordered_set<ssa_exprt, irep_hash>::const_iterator |
377 |
| - it=variables.begin(); |
378 |
| - it!=variables.end(); |
379 |
| - it++) |
| 389 | + for(auto it = all_current_names_range.begin(); |
| 390 | + it != all_current_names_range.end(); |
| 391 | + ++it) |
380 | 392 | {
|
381 | 393 | const irep_idt l1_identifier=it->get_identifier();
|
382 | 394 | const irep_idt &obj_identifier=it->get_object_name();
|
|
0 commit comments