@@ -414,39 +414,6 @@ void goto_symext::merge_goto(
414
414
}
415
415
}
416
416
417
- // / Applies f to `(k, ssa, i, j)` if the first map maps k to (ssa, i) and
418
- // / the second to (ssa', j). If the first map has an entry for k but not the
419
- // / second one then j is 0, and when the first map has no entry for k then i = 0
420
- static void for_each2 (
421
- const std::map<irep_idt, std::pair<ssa_exprt, unsigned >> &first_map,
422
- const std::map<irep_idt, std::pair<ssa_exprt, unsigned >> &second_map,
423
- const std::function<void (const ssa_exprt &, unsigned , unsigned )> &f)
424
- {
425
- auto second_it = second_map.begin ();
426
- for (const auto &first_pair : first_map)
427
- {
428
- while (second_it != second_map.end () && second_it->first < first_pair.first )
429
- {
430
- f (second_it->second .first , 0 , second_it->second .second );
431
- ++second_it;
432
- }
433
- const ssa_exprt &ssa = first_pair.second .first ;
434
- const unsigned count = first_pair.second .second ;
435
- if (second_it != second_map.end () && second_it->first == first_pair.first )
436
- {
437
- f (ssa, count, second_it->second .second );
438
- ++second_it;
439
- }
440
- else
441
- f (ssa, count, 0 );
442
- }
443
- while (second_it != second_map.end ())
444
- {
445
- f (second_it->second .first , 0 , second_it->second .second );
446
- ++second_it;
447
- }
448
- }
449
-
450
417
// / Helper function for \c phi_function which merges the names of an identifier
451
418
// / for two different states.
452
419
// / \param goto_state: first state
@@ -596,23 +563,58 @@ void goto_symext::phi_function(
596
563
// this gets the diff between the guards
597
564
diff_guard -= dest_state.guard ;
598
565
599
- for_each2 (
600
- goto_state.get_level2 ().current_names ,
601
- dest_state.get_level2 ().current_names ,
602
- [&](const ssa_exprt &ssa, unsigned goto_count, unsigned dest_count) {
603
- merge_names (
604
- goto_state,
605
- dest_state,
606
- ns,
607
- diff_guard,
608
- log,
609
- symex_config.simplify_opt ,
610
- target,
611
- path_storage.dirty ,
612
- ssa,
613
- goto_count,
614
- dest_count);
615
- });
566
+ symex_renaming_levelt::current_namest::delta_viewt delta_view;
567
+ goto_state.get_level2 ().current_names .get_delta_view (
568
+ dest_state.get_level2 ().current_names , delta_view, false );
569
+
570
+ for (const auto &delta_item : delta_view)
571
+ {
572
+ const ssa_exprt &ssa = delta_item.m .first ;
573
+ unsigned goto_count = delta_item.m .second ;
574
+ unsigned dest_count = !delta_item.is_in_both_maps ()
575
+ ? 0
576
+ : delta_item.get_other_map_value ().second ;
577
+
578
+ merge_names (
579
+ goto_state,
580
+ dest_state,
581
+ ns,
582
+ diff_guard,
583
+ log,
584
+ symex_config.simplify_opt ,
585
+ target,
586
+ path_storage.dirty ,
587
+ ssa,
588
+ goto_count,
589
+ dest_count);
590
+ }
591
+
592
+ delta_view.clear ();
593
+ dest_state.get_level2 ().current_names .get_delta_view (
594
+ goto_state.get_level2 ().current_names , delta_view, false );
595
+
596
+ for (const auto &delta_item : delta_view)
597
+ {
598
+ if (delta_item.is_in_both_maps ())
599
+ continue ;
600
+
601
+ const ssa_exprt &ssa = delta_item.m .first ;
602
+ unsigned goto_count = 0 ;
603
+ unsigned dest_count = delta_item.m .second ;
604
+
605
+ merge_names (
606
+ goto_state,
607
+ dest_state,
608
+ ns,
609
+ diff_guard,
610
+ log,
611
+ symex_config.simplify_opt ,
612
+ target,
613
+ path_storage.dirty ,
614
+ ssa,
615
+ goto_count,
616
+ dest_count);
617
+ }
616
618
}
617
619
618
620
void goto_symext::loop_bound_exceeded (
0 commit comments