@@ -45,7 +45,8 @@ bool dep_graph_domaint::merge(
45
45
changed|=merge_control_dependencies (
46
46
src.control_deps ,
47
47
src.control_dep_candidates ,
48
- src.control_dep_calls );
48
+ src.control_dep_calls ,
49
+ src.control_dep_call_candidates );
49
50
50
51
has_changed=false ;
51
52
has_values=tvt::unknown ();
@@ -71,19 +72,19 @@ void dep_graph_domaint::control_dependencies(
71
72
72
73
// Add new candidates
73
74
75
+ PRECONDITION (!control_dep_call_candidates.empty ());
76
+
74
77
if (from->is_goto () || from->is_assume ())
75
78
control_dep_candidates.insert (from);
76
79
else if (from->is_end_function ())
77
80
{
78
81
control_deps.clear ();
79
82
control_dep_candidates.clear ();
80
83
control_dep_calls.clear ();
84
+ control_dep_call_candidates.clear ();
81
85
return ;
82
86
}
83
87
84
- if (control_dep_candidates.empty ())
85
- return ;
86
-
87
88
// Compute postdominators if needed
88
89
89
90
const goto_functionst &goto_functions=dep_graph.goto_functions ;
@@ -152,10 +153,18 @@ void dep_graph_domaint::control_dependencies(
152
153
}
153
154
154
155
control_deps.insert (std::make_pair (cd, branch));
155
- control_dep_calls.clear ();
156
156
}
157
157
}
158
158
159
+ if (control_deps.empty ())
160
+ {
161
+ util_inplace_set_union (control_dep_calls, control_dep_call_candidates);
162
+ }
163
+ else
164
+ {
165
+ control_dep_calls.clear ();
166
+ }
167
+
159
168
// add edges to the graph
160
169
for (const auto &c_dep : control_deps)
161
170
dep_graph.add_dep (dep_edget::kindt::CTRL, c_dep.first , to);
@@ -264,7 +273,8 @@ void dep_graph_domaint::control_dependencies(
264
273
bool dep_graph_domaint::merge_control_dependencies (
265
274
const control_depst &other_control_deps,
266
275
const control_dep_candidatest &other_control_dep_candidates,
267
- const control_dep_callst &other_control_dep_calls)
276
+ const control_dep_callst &other_control_dep_calls,
277
+ const control_dep_callst &other_control_dep_call_candidates)
268
278
{
269
279
bool changed=false ;
270
280
@@ -323,6 +333,16 @@ bool dep_graph_domaint::merge_control_dependencies(
323
333
324
334
changed|=n!=control_dep_calls.size ();
325
335
336
+ // Merge call control dependency candidates
337
+
338
+ n=control_dep_call_candidates.size ();
339
+
340
+ control_dep_call_candidates.insert (
341
+ other_control_dep_call_candidates.begin (),
342
+ other_control_dep_call_candidates.end ());
343
+
344
+ changed|=n!=control_dep_call_candidates.size ();
345
+
326
346
return changed;
327
347
}
328
348
@@ -489,14 +509,18 @@ void dep_graph_domaint::transform(
489
509
if (s->merge_control_dependencies (
490
510
control_deps,
491
511
control_dep_candidates,
492
- control_dep_calls))
512
+ control_dep_calls,
513
+ control_dep_call_candidates))
493
514
s->has_changed =true ;
494
515
495
516
control_deps.clear ();
496
517
control_dep_candidates.clear ();
497
518
498
519
control_dep_calls.clear ();
499
520
control_dep_calls.insert (from);
521
+
522
+ control_dep_call_candidates.clear ();
523
+ control_dep_call_candidates.insert (from);
500
524
}
501
525
}
502
526
else
0 commit comments