@@ -61,8 +61,7 @@ void constant_propagator_domaint::transform(
61
61
dynamic_cast <constant_propagator_ait *>(&ai);
62
62
bool have_dirty=(cp!=nullptr );
63
63
64
- if (values.is_bottom )
65
- return ;
64
+ assert (!values.is_bottom );
66
65
67
66
if (from->is_decl ())
68
67
{
@@ -95,6 +94,12 @@ void constant_propagator_domaint::transform(
95
94
else
96
95
{
97
96
two_way_propagate_rec (g, ns);
97
+ // If two way propagate is enabled then it may be possible to detect
98
+ // that the branch condition is infeasible and thus the domain should
99
+ // be set to bottom. Without it the domain will only be set to bottom
100
+ // if the guard expression is trivially (i.e. without context) false.
101
+ INVARIANT (!values.is_bottom ,
102
+ " Without two-way propagation this should be impossible." );
98
103
}
99
104
}
100
105
else if (from->is_dead ())
@@ -192,6 +197,9 @@ void constant_propagator_domaint::transform(
192
197
}
193
198
}
194
199
200
+ INVARIANT (from->is_goto () || !values.is_bottom ,
201
+ " Transform only sets bottom by using branch conditions" );
202
+
195
203
#ifdef DEBUG
196
204
std::cout << " After:\n " ;
197
205
output (std::cout, ai, ns);
@@ -210,6 +218,7 @@ bool constant_propagator_domaint::two_way_propagate_rec(
210
218
211
219
bool change=false ;
212
220
221
+ #if 0
213
222
if(expr.id()==ID_and)
214
223
{
215
224
// need a fixed point here to get the most out of it
@@ -219,7 +228,7 @@ bool constant_propagator_domaint::two_way_propagate_rec(
219
228
220
229
forall_operands(it, expr)
221
230
if(two_way_propagate_rec(*it, ns))
222
- change = true ;
231
+ change= true;
223
232
}
224
233
while(change);
225
234
}
@@ -229,12 +238,13 @@ bool constant_propagator_domaint::two_way_propagate_rec(
229
238
const exprt &rhs=expr.op1();
230
239
231
240
// two-way propagation
232
- valuest copy_values = values;
241
+ valuest copy_values= values;
233
242
assign_rec(copy_values, lhs, rhs, ns);
234
243
if(!values.is_constant(rhs) || values.is_constant(lhs))
235
244
assign_rec(values, rhs, lhs, ns);
236
- change = values.meet (copy_values);
245
+ change= values.meet(copy_values);
237
246
}
247
+ #endif
238
248
239
249
#ifdef DEBUG
240
250
std::cout << " two_way_propagate_rec: " << change << ' \n ' ;
0 commit comments