File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2174,14 +2174,23 @@ simplify_exprt::simplify_complex(const unary_exprt &expr)
21742174simplify_exprt::resultt<>
21752175simplify_exprt::simplify_overflow_binary (const binary_overflow_exprt &expr)
21762176{
2177- // zero is a neutral element for all operations supported here
2177+ // When one operand is zero, an overflow can only occur for a subtraction from
2178+ // zero.
21782179 if (
21792180 expr.op1 ().is_zero () ||
21802181 (expr.op0 ().is_zero () && expr.id () != ID_overflow_minus))
21812182 {
21822183 return false_exprt{};
21832184 }
21842185
2186+ // One is neutral element for multiplication
2187+ if (
2188+ expr.id () == ID_overflow_mult &&
2189+ (expr.op0 ().is_one () || expr.op1 ().is_one ()))
2190+ {
2191+ return false_exprt{};
2192+ }
2193+
21852194 // we only handle the case of same operand types
21862195 if (expr.op0 ().type () != expr.op1 ().type ())
21872196 return unchanged (expr);
You can’t perform that action at this time.
0 commit comments