@@ -763,14 +763,10 @@ bool goto_program2codet::set_block_end_points(
763763 case_end!=upper_bound;
764764 ++case_end)
765765 {
766- cfg_dominatorst::cfgt::entry_mapt::const_iterator i_entry=
767- dominators.cfg .entry_map .find (case_end);
768- assert (i_entry!=dominators.cfg .entry_map .end ());
769- const cfg_dominatorst::cfgt::nodet &n=
770- dominators.cfg [i_entry->second ];
766+ const auto &case_end_node = dominators.get_node (case_end);
771767
772768 // ignore dead instructions for the following checks
773- if (n. dominators .empty ( ))
769+ if (! dominators.program_point_reachable (case_end_node ))
774770 {
775771 // simplification may have figured out that a case is unreachable
776772 // this is possibly getting too weird, abort to be safe
@@ -781,7 +777,7 @@ bool goto_program2codet::set_block_end_points(
781777 }
782778
783779 // find the last instruction dominated by the case start
784- if (n. dominators .find (it->case_start )==n. dominators . end ( ))
780+ if (! dominators.dominates (it->case_start , case_end_node ))
785781 break ;
786782
787783 if (!processed_locations.insert (case_end->location_number ).second )
@@ -818,13 +814,7 @@ bool goto_program2codet::remove_default(
818814 next_case!=goto_program.instructions .end ();
819815 ++next_case)
820816 {
821- cfg_dominatorst::cfgt::entry_mapt::const_iterator i_entry=
822- dominators.cfg .entry_map .find (next_case);
823- assert (i_entry!=dominators.cfg .entry_map .end ());
824- const cfg_dominatorst::cfgt::nodet &n=
825- dominators.cfg [i_entry->second ];
826-
827- if (!n.dominators .empty ())
817+ if (dominators.program_point_reachable (next_case))
828818 break ;
829819 }
830820
@@ -876,10 +866,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_switch(
876866
877867 // always use convert_goto_if for dead code as the construction below relies
878868 // on effective dominator information
879- cfg_dominatorst::cfgt::entry_mapt::const_iterator t_entry=
880- dominators.cfg .entry_map .find (target);
881- assert (t_entry!=dominators.cfg .entry_map .end ());
882- if (dominators.cfg [t_entry->second ].dominators .empty ())
869+ if (!dominators.program_point_reachable (target))
883870 return convert_goto_if (target, upper_bound, dest);
884871
885872 // maybe, let's try some more
@@ -1019,13 +1006,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_switch(
10191006 if (processed_locations.find (it->location_number )==
10201007 processed_locations.end ())
10211008 {
1022- cfg_dominatorst::cfgt::entry_mapt::const_iterator it_entry=
1023- dominators.cfg .entry_map .find (it);
1024- assert (it_entry!=dominators.cfg .entry_map .end ());
1025- const cfg_dominatorst::cfgt::nodet &n=
1026- dominators.cfg [it_entry->second ];
1027-
1028- if (!n.dominators .empty ())
1009+ if (dominators.program_point_reachable (it))
10291010 {
10301011 toplevel_block.swap (toplevel_block_bak);
10311012 return convert_goto_if (orig_target, upper_bound, dest);
@@ -1128,13 +1109,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_break_continue(
11281109 next!=upper_bound && next!=goto_program.instructions .end ();
11291110 ++next)
11301111 {
1131- cfg_dominatorst::cfgt::entry_mapt::const_iterator i_entry=
1132- dominators.cfg .entry_map .find (next);
1133- assert (i_entry!=dominators.cfg .entry_map .end ());
1134- const cfg_dominatorst::cfgt::nodet &n=
1135- dominators.cfg [i_entry->second ];
1136-
1137- if (!n.dominators .empty ())
1112+ if (dominators.program_point_reachable (next))
11381113 break ;
11391114 }
11401115
@@ -1168,13 +1143,7 @@ goto_programt::const_targett goto_program2codet::convert_goto_break_continue(
11681143 after_loop!=goto_program.instructions .end ();
11691144 ++after_loop)
11701145 {
1171- cfg_dominatorst::cfgt::entry_mapt::const_iterator i_entry=
1172- dominators.cfg .entry_map .find (after_loop);
1173- assert (i_entry!=dominators.cfg .entry_map .end ());
1174- const cfg_dominatorst::cfgt::nodet &n=
1175- dominators.cfg [i_entry->second ];
1176-
1177- if (!n.dominators .empty ())
1146+ if (dominators.program_point_reachable (after_loop))
11781147 break ;
11791148 }
11801149
@@ -1207,15 +1176,10 @@ goto_programt::const_targett goto_program2codet::convert_goto_goto(
12071176 return target;
12081177
12091178 const cfg_dominatorst &dominators=loops.get_dominator_info ();
1210- cfg_dominatorst::cfgt::entry_mapt::const_iterator it_entry=
1211- dominators.cfg .entry_map .find (target);
1212- assert (it_entry!=dominators.cfg .entry_map .end ());
1213- const cfg_dominatorst::cfgt::nodet &n=
1214- dominators.cfg [it_entry->second ];
12151179
12161180 // skip dead goto L as the label might be skipped if it is dead
12171181 // as well and at the end of a case block
1218- if (n. dominators .empty ( ))
1182+ if (! dominators.program_point_reachable (target ))
12191183 return target;
12201184
12211185 std::stringstream label;
0 commit comments