Skip to content

Commit b582561

Browse files
authored
Fix reduce_expr_modulo of vector in Solve.cpp (#8089)
* Fix reduce_expr_modulo of vector in Solve.cpp * Fix test
1 parent f2d750f commit b582561

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Solve.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ class SolveExpression : public IRMutator {
394394
if (a_uses_var && !b_uses_var) {
395395
const int64_t *ib = as_const_int(b);
396396
auto is_multiple_of_b = [&](const Expr &e) {
397-
if (ib) {
397+
if (ib && op->type.is_scalar()) {
398398
int64_t r = 0;
399399
return reduce_expr_modulo(e, *ib, &r) && r == 0;
400400
} else {
@@ -1478,6 +1478,9 @@ void solve_test() {
14781478
check_solve(min(x + y, x - z), x + min(y, 0 - z));
14791479
check_solve(max(x + y, x - z), x + max(y, 0 - z));
14801480

1481+
check_solve((5 * Broadcast::make(x, 4) + y) / 5,
1482+
Broadcast::make(x, 4) + (Broadcast::make(y, 4) / 5));
1483+
14811484
debug(0) << "Solve test passed\n";
14821485
}
14831486

0 commit comments

Comments
 (0)