Skip to content

Commit

Permalink
Fix two non-idiomatic uses of node_type (#8520)
Browse files Browse the repository at this point in the history
  • Loading branch information
abadams authored Dec 18, 2024
1 parent 153e35d commit d3f19bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
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

0 comments on commit d3f19bd

Please sign in to comment.