From 90e3579820d2ed72300e98ac5dd15fcbc846f159 Mon Sep 17 00:00:00 2001 From: "Emil J. Tywoniak" Date: Fri, 8 Aug 2025 12:32:43 +0200 Subject: [PATCH] ast: remove null_check as dead code --- frontends/ast/ast.h | 1 - frontends/ast/simplify.cc | 12 ------------ 2 files changed, 13 deletions(-) diff --git a/frontends/ast/ast.h b/frontends/ast/ast.h index 6804c6a30..4baa2a3f6 100644 --- a/frontends/ast/ast.h +++ b/frontends/ast/ast.h @@ -260,7 +260,6 @@ namespace AST // simplify() creates a simpler AST by unrolling for-loops, expanding generate blocks, etc. // it also sets the id2ast pointers so that identifier lookups are fast in genRTLIL() bool simplify(bool const_fold, int stage, int width_hint, bool sign_hint); - void null_check(); void replace_result_wire_name_in_function(const std::string &from, const std::string &to); std::unique_ptr readmem(bool is_readmemh, std::string mem_filename, AstNode *memory, int start_addr, int finish_addr, bool unconditional_init); void expand_genblock(const std::string &prefix); diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index d4191cef7..e6954dbb9 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -888,16 +888,6 @@ static void check_auto_nosync(AstNode *node) check_auto_nosync(child.get()); } -void AstNode::null_check() -{ - for (auto& child : children) { - // if (!child) - // VALGRIND_PRINTF_BACKTRACE("null child"); - log_assert((bool) child); - child->null_check(); - } -} - // convert the AST into a simpler AST that has all parameters substituted by their // values, unrolled for-loops, expanded generate blocks, etc. when this function // is done with an AST it can be converted into RTLIL using genRTLIL(). @@ -906,7 +896,6 @@ void AstNode::null_check() // nodes that link to a different node using names and lexical scoping. bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hint) { - // null_check(); static int recursion_counter = 0; static bool deep_recursion_warning = false; @@ -4434,7 +4423,6 @@ apply_newNode: // dumpAst(stderr, "- "); // newNode->dumpAst(stderr, "+ "); log_assert(newNode != nullptr); - // newNode->null_check(); newNode->location.begin.filename = location.begin.filename; newNode->location = location; newNode->cloneInto(*this);