Skip to content

Commit 85a3b07

Browse files
authored
Add missing addition simplifier rules (#8630)
Add missing add simplifier rules These mirror a bunch of distributive-law-related cancellation rules in Simplify_Sub.cpp Formally verified.
1 parent 42755f2 commit 85a3b07

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Simplify_Add.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ Expr Simplify::visit(const Add *op, ExprInfo *info) {
106106
rewrite(x*y + y*z, (x + z)*y) ||
107107
rewrite(y*x + z*y, y*(x + z)) ||
108108
rewrite(y*x + y*z, y*(x + z)) ||
109+
110+
rewrite((x*y) + (z - (w*x)), z + (x*(y - w))) ||
111+
rewrite((x*y) + (z - (w*y)), z + (y*(x - w))) ||
112+
rewrite((x*y) + (z - (x*w)), z + (x*(y - w))) ||
113+
rewrite((x*y) + (z - (y*w)), z + (y*(x - w))) ||
114+
109115
rewrite(x*c0 + y*c1, (x + y*fold(c1/c0)) * c0, c1 % c0 == 0) ||
110116
rewrite(x*c0 + y*c1, (x*fold(c0/c1) + y) * c1, c0 % c1 == 0) ||
111117

0 commit comments

Comments
 (0)