Skip to content

Commit

Permalink
Fix Canonical Simplifier (apache#5505)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinthesun authored and trevor-m committed Jun 18, 2020
1 parent 6488bbd commit ae62e23
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/arith/canonical_simplify.cc
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,7 @@ SplitModConst(SplitExpr lhs, int64_t cval, DivMode div_mode) {
lhs->upper_factor != SplitExprNode::kPosInf) {
auto updated = ToSplitExpr(this->VisitExpr(ModImpl(
lhs->index, make_const(lhs.dtype(), new_upper_factor), div_mode)));
updated.CopyOnWrite()->scale = lhs->scale;
// re-apply the lower_factor
if (lhs->lower_factor != 1) {
return SplitDivConst(updated, lhs->lower_factor, div_mode);
Expand Down
2 changes: 1 addition & 1 deletion tests/python/unittest/test_arith_canonical_simplify.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def test_floormod_simplify():
x, y = te.var("x"), te.var("y")
ck.verify(flm(flm((x*4) + y - 466036, 24528) - 24512, 16),
flm((x*4) + y + 12, 16))

ck.verify(flm(flm((x*4), 16), 8), flm(x, 2) * 4)


def test_canonical_mixed():
Expand Down

0 comments on commit ae62e23

Please sign in to comment.