Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 26, 2022
1 parent c60c70a commit decb8c3
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 2 additions & 1 deletion taichi/transforms/scalar_pointer_lowerer.cpp
Original file line number Diff line number Diff line change
@@ -88,7 +88,8 @@ void ScalarPointerLowerer::run() {
// Unless it is an invalid out-of-bound access, we can assume
// "indices_[k_] < prev" so we don't need a mod here.
auto const_next = lowered_->push_back<ConstStmt>(TypedConstant(next));
extracted = lowered_->push_back<BinaryOpStmt>(BinaryOpType::div, indices_[k_], const_next);
extracted = lowered_->push_back<BinaryOpStmt>(
BinaryOpType::div, indices_[k_], const_next);
is_first_extraction[k] = false;
} else {
extracted = generate_mod_x_div_y(lowered_, indices_[k_], prev, next);
16 changes: 12 additions & 4 deletions tests/cpp/transforms/scalar_pointer_lowerer_test.cpp
Original file line number Diff line number Diff line change
@@ -114,11 +114,19 @@ TEST(ScalarPointerLowerer, EliminateMod) {
SNode *dense_3 = &(dense_2->dense({Axis{0}}, /*size=*/5, kPacked));
SNode *leaf_1 = &(dense_1->insert_children(SNodeType::place));
SNode *leaf_2 = &(dense_3->insert_children(SNodeType::place));
LowererImpl lowerer_1{leaf_1, {index, index}, SNodeOpType::undefined,
/*is_bit_vectorized=*/false, &lowered, kPacked};
LowererImpl lowerer_1{leaf_1,
{index, index},
SNodeOpType::undefined,
/*is_bit_vectorized=*/false,
&lowered,
kPacked};
lowerer_1.run();
LowererImpl lowerer_2{leaf_2, {index}, SNodeOpType::undefined,
/*is_bit_vectorized=*/false, &lowered, kPacked};
LowererImpl lowerer_2{leaf_2,
{index},
SNodeOpType::undefined,
/*is_bit_vectorized=*/false,
&lowered,
kPacked};
lowerer_2.run();
for (int i = 0; i < lowered.size(); i++) {
ASSERT_FALSE(lowered[i]->is<BinaryOpStmt>() &&

0 comments on commit decb8c3

Please sign in to comment.