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

Fix two non-idiomatic uses of node_type #8520

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 2 additions & 4 deletions src/Derivative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ void ReverseAccumulationVisitor::propagate_adjoints(
let_var_mapping.clear();
let_variables.clear();
for (const auto &expr : expr_list) {
if (expr.get()->node_type == IRNodeType::Let) {
const Let *op = expr.as<Let>();
if (const Let *op = expr.as<Let>()) {
// Assume Let variables are unique
internal_assert(let_var_mapping.find(op->name) == let_var_mapping.end());
let_var_mapping[op->name] = op->value;
Expand Down Expand Up @@ -660,8 +659,7 @@ void ReverseAccumulationVisitor::propagate_adjoints(
let_var_mapping.clear();
let_variables.clear();
for (const auto &expr : expr_list) {
if (expr.get()->node_type == IRNodeType::Let) {
const Let *op = expr.as<Let>();
if (const Let *op = expr.as<Let>()) {
// Assume Let variables are unique
internal_assert(let_var_mapping.find(op->name) == let_var_mapping.end());
let_var_mapping[op->name] = op->value;
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ std::pair<Serialize::Stmt, Offset<void>> Serializer::serialize_stmt(FlatBufferBu
if (!stmt.defined()) {
return std::make_pair(Serialize::Stmt::UndefinedStmt, Serialize::CreateUndefinedStmt(builder).Union());
}
switch (stmt->node_type) {
switch (stmt.node_type()) {
case IRNodeType::LetStmt: {
const auto *const let_stmt = stmt.as<LetStmt>();
const auto name_serialized = serialize_string(builder, let_stmt->name);
Expand Down Expand Up @@ -681,7 +681,7 @@ std::pair<Serialize::Expr, Offset<void>> Serializer::serialize_expr(FlatBufferBu
if (!expr.defined()) {
return std::make_pair(Serialize::Expr::UndefinedExpr, Serialize::CreateUndefinedExpr(builder).Union());
}
switch (expr->node_type) {
switch (expr.node_type()) {
case IRNodeType::IntImm: {
const auto *const int_imm = expr.as<IntImm>();
const auto type_serialized = serialize_type(builder, int_imm->type);
Expand Down