@@ -55,7 +55,7 @@ static bool is_same_target(
55
55
56
56
// / Perform backwards depth-first search of the control-flow graph of the
57
57
// / goto program, starting from the nodes corresponding to the criterion and
58
- // / the instructions that might be executed concurrently. Set reaches_assertion
58
+ // / the instructions that might be executed concurrently. Set backward_state
59
59
// / to true for every instruction visited.
60
60
// / \param is_threaded Instructions that might be executed concurrently
61
61
// / \param criterion the criterion we are trying to hit
@@ -74,9 +74,18 @@ void reachability_slicert::fixedpoint_to_assertions(
74
74
const auto caller_is_known = stack.back ().caller_is_known ;
75
75
stack.pop_back ();
76
76
77
- if (node.reaches_assertion )
77
+ if (
78
+ node.backward_state ==
79
+ slicer_entryt::dfs_statust::BODY_AND_CALLERS_SEEN ||
80
+ (caller_is_known &&
81
+ node.backward_state == slicer_entryt::dfs_statust::BODY_SEEN))
82
+ {
78
83
continue ;
79
- node.reaches_assertion = true ;
84
+ }
85
+ node.backward_state =
86
+ caller_is_known ?
87
+ slicer_entryt::dfs_statust::BODY_SEEN :
88
+ slicer_entryt::dfs_statust::BODY_AND_CALLERS_SEEN;
80
89
81
90
for (const auto &edge : node.in )
82
91
{
@@ -111,8 +120,8 @@ void reachability_slicert::fixedpoint_to_assertions(
111
120
112
121
// / Perform forwards depth-first search of the control-flow graph of the
113
122
// / goto program, starting from the nodes corresponding to the criterion and
114
- // / the instructions that might be executed concurrently. Set reaches_assertion
115
- // / to true for every instruction visited.
123
+ // / the instructions that might be executed concurrently. Set
124
+ // / reachable_from_assertion to true for every instruction visited.
116
125
// / \param is_threaded Instructions that might be executed concurrently
117
126
// / \param criterion the criterion we are trying to hit
118
127
void reachability_slicert::fixedpoint_from_assertions (
@@ -182,7 +191,7 @@ void reachability_slicert::fixedpoint_from_assertions(
182
191
}
183
192
184
193
// / This function removes all instructions that have the flag
185
- // / reaches_assertion or reachable_from_assertion set to true;
194
+ // / backward_state or reachable_from_assertion set to true;
186
195
void reachability_slicert::slice (goto_functionst &goto_functions)
187
196
{
188
197
// now replace those instructions that do not reach any assertions
@@ -195,9 +204,12 @@ void reachability_slicert::slice(goto_functionst &goto_functions)
195
204
{
196
205
const cfgt::nodet &e=cfg[cfg.entry_map [i_it]];
197
206
if (
198
- !e.reaches_assertion && !e.reachable_from_assertion &&
207
+ e.backward_state == slicer_entryt::dfs_statust::NOT_SEEN &&
208
+ !e.reachable_from_assertion &&
199
209
!i_it->is_end_function ())
210
+ {
200
211
i_it->make_assumption (false_exprt ());
212
+ }
201
213
}
202
214
203
215
// replace unreachable code by skip
0 commit comments