@@ -224,55 +224,38 @@ void dep_graph_domaint::transform(
224224
225225 // We do not propagate control dependencies on function calls, i.e., only the
226226 // entry point of a function should have a control dependency on the call
227- if (!control_deps.empty ())
228- {
229- const goto_programt::const_targett &dep = *control_deps.begin ();
230- if (dep->is_function_call ())
231- {
232- INVARIANT (
233- std::all_of (
234- std::next (control_deps.begin ()),
235- control_deps.end (),
236- [](const goto_programt::const_targett &d) {
237- return d->is_function_call ();
238- }),
239- " All entries must be function calls" );
240-
241- control_deps.clear ();
242- }
243- }
227+ depst filtered_control_deps;
228+ std::copy_if (
229+ control_deps.begin (),
230+ control_deps.end (),
231+ std::inserter (filtered_control_deps, filtered_control_deps.end ()),
232+ [](goto_programt::const_targett dep) { return !dep->is_function_call (); });
233+ control_deps = std::move (filtered_control_deps);
244234
245235 // propagate control dependencies across function calls
246- if (from->is_function_call ())
236+ if (from->is_function_call () && function_from != function_to )
247237 {
248- if (function_from == function_to)
249- {
250- control_dependencies (function_from, from, to, *dep_graph);
251- }
252- else
253- {
254- // edge to function entry point
255- const goto_programt::const_targett next = std::next (from);
238+ // edge to function entry point
239+ const goto_programt::const_targett next = std::next (from);
256240
257- dep_graph_domaint *s=
258- dynamic_cast <dep_graph_domaint*>(&(dep_graph->get_state (next)));
259- assert (s!= nullptr );
241+ dep_graph_domaint *s =
242+ dynamic_cast <dep_graph_domaint *>(&(dep_graph->get_state (next)));
243+ CHECK_RETURN (s != nullptr );
260244
261- if (s->is_bottom ())
262- {
263- s->has_values = tvt::unknown ();
264- s->has_changed = true ;
265- }
245+ if (s->is_bottom ())
246+ {
247+ s->has_values = tvt::unknown ();
248+ s->has_changed = true ;
249+ }
266250
267- s->has_changed |= util_inplace_set_union (s->control_deps , control_deps);
268- s->has_changed |= util_inplace_set_union (
269- s->control_dep_candidates , control_dep_candidates);
251+ s->has_changed |= util_inplace_set_union (s->control_deps , control_deps);
252+ s->has_changed |=
253+ util_inplace_set_union ( s->control_dep_candidates , control_dep_candidates);
270254
271- control_deps.clear ();
272- control_deps.insert (from);
255+ control_deps.clear ();
256+ control_deps.insert (from);
273257
274- control_dep_candidates.clear ();
275- }
258+ control_dep_candidates.clear ();
276259 }
277260 else
278261 control_dependencies (function_from, from, to, *dep_graph);
0 commit comments