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

[misc] Remove unused code/comments in transforms/simpilfy.cpp #1812

Merged
merged 1 commit into from
Aug 31, 2020
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
48 changes: 0 additions & 48 deletions taichi/transforms/simplify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,57 +71,9 @@ class BasicBlockSimplify : public IRVisitor {
}
}

// weaken indexing
Copy link
Member Author

Choose a reason for hiding this comment

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

This part simplifies LoopIndex + constant(a) + constant(b) + constant(c) into LoopIndex + constant(a + b + c).

// TODO: StructForStmt::loop_vars is deprecated
/*if (current_struct_for && stmt->width() == 1) {
auto &loop_vars = current_struct_for->loop_vars;
for (int k = 0; k < (int)loop_vars.size(); k++) {
auto diff = irpass::analysis::value_diff(
stmt->elements[0].stmt, stmt->elements[0].index,
current_struct_for->loop_vars[k]);
if (diff.linear_related() && diff.certain()) {
auto load = stmt->insert_before_me(
Stmt::make<LocalLoadStmt>(LocalAddress(loop_vars[k], 0)));
load->ret_type.data_type = DataType::i32;
auto constant = stmt->insert_before_me(
Stmt::make<ConstStmt>(TypedConstant(diff.low)));
constant->ret_type.data_type = DataType::i32;
auto add = stmt->insert_before_me(
Stmt::make<BinaryOpStmt>(BinaryOpType::add, load, constant));
add->ret_type.data_type = DataType::i32;
stmt->replace_with(add);
stmt->parent->erase(stmt);
throw IRModified();
}
}
}*/

set_done(stmt);
}

// Local variable operation optimizations:
// 1. Store forwarding
//

bool modifies_local(Stmt *stmt, std::vector<Stmt *> vars) {
if (stmt->is<LocalStoreStmt>()) {
auto st = stmt->as<LocalStoreStmt>();
for (auto var : vars) {
if (st->ptr == var) {
return true;
}
}
} else if (stmt->is<AtomicOpStmt>()) {
auto st = stmt->as<AtomicOpStmt>();
for (auto var : vars) {
if (st->dest == var) {
return true;
}
}
}
return false;
}

void visit(GlobalLoadStmt *stmt) override {
if (is_done(stmt))
return;
Expand Down