Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some EVAL_IN_LAMBDAs to Simplify_Sub.cpp #8230

Merged
merged 1 commit into from
May 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Simplify_Sub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ Expr Simplify::visit(const Sub *op, ExprInfo *bounds) {
rewrite((slice(x, c0, c1, c2) - z) - slice(y, c0, c1, c2), slice(x - y, c0, c1, c2) - z, c2 > 1 && lanes_of(x) == lanes_of(y)) ||
rewrite((z - slice(x, c0, c1, c2)) - slice(y, c0, c1, c2), z - slice(x + y, c0, c1, c2), c2 > 1 && lanes_of(x) == lanes_of(y)) ||

(no_overflow(op->type) &&
(no_overflow(op->type) && EVAL_IN_LAMBDA
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is only happening in MSVC, it might be worth only doing this #ifdef _MSC_VER?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also speeds up compile times for gcc slightly

(rewrite(max(x, y) - x, max(y - x, 0)) ||
rewrite(min(x, y) - x, min(y - x, 0)) ||
rewrite(max(x, y) - y, max(x - y, 0)) ||
Expand Down Expand Up @@ -387,7 +387,7 @@ Expr Simplify::visit(const Sub *op, ExprInfo *bounds) {
rewrite(max(y, x + c0) - max(x + c1, w), max(y - max(x + c1, w), fold(c0 - c1)), can_prove(y + c1 >= w + c0, this)) ||
rewrite(max(y, x + c0) - max(x + c1, w), min(max(x + c0, y) - w, fold(c0 - c1)), can_prove(y + c1 <= w + c0, this)))) ||

(no_overflow_int(op->type) &&
(no_overflow_int(op->type) && EVAL_IN_LAMBDA
(rewrite(c0 - (c1 - x)/c2, (fold(c0*c2 - c1 + c2 - 1) + x)/c2, c2 > 0) ||
rewrite(c0 - (x + c1)/c2, (fold(c0*c2 - c1 + c2 - 1) - x)/c2, c2 > 0) ||
rewrite(x - (x + y)/c0, (x*fold(c0 - 1) - y + fold(c0 - 1))/c0, c0 > 0) ||
Expand Down
Loading