@@ -153,7 +153,6 @@ simplify_exprt::resultt<> simplify_exprt::simplify_boolean(const exprt &expr)
153153 mp_integer higher;
154154 };
155155 boundst bounds;
156- bool structure_matched = false ;
157156
158157 // Before we do anything else, we need to "pattern match" against the
159158 // expression and make sure that it has the structure we're looking for.
@@ -215,24 +214,18 @@ simplify_exprt::resultt<> simplify_exprt::simplify_boolean(const exprt &expr)
215214 };
216215
217216 // We need to match both operands, at the particular sequence we expect.
218- structure_matched | = match_first_operand (new_operands[0 ]);
219- structure_matched &= match_second_operand (new_operands[1 ]);
217+ bool structure_matched = match_first_operand (new_operands[0 ]) &&
218+ match_second_operand (new_operands[1 ]);
220219
221220 if (structure_matched && bounds.lower == bounds.higher )
222221 {
223- // Go through the expression again and convert >= operand into ==
224- for (const auto &op : new_operands)
225- {
226- if (
227- const auto ge_expr =
228- expr_try_dynamic_cast<greater_than_or_equal_exprt>(op))
229- {
230- equal_exprt new_expr{ge_expr->lhs (), ge_expr->rhs ()};
231- return changed (new_expr);
232- }
233- else
234- continue ;
235- }
222+ // If we are here, we have matched the structure we expected, so we can
223+ // make some reasonable assumptions about where certain info we need is
224+ // located at.
225+ const auto ge_expr =
226+ expr_dynamic_cast<greater_than_or_equal_exprt>(new_operands[0 ]);
227+ equal_exprt new_expr{ge_expr.lhs (), ge_expr.rhs ()};
228+ return changed (new_expr);
236229 }
237230 }
238231
0 commit comments