From 3a4fa325cc17ab0ecb1f0d818e7a11804bbf4c61 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Thu, 16 Oct 2025 02:13:33 +0000 Subject: [PATCH] Remove explicit empty-string check when looking up IdStrings --- kernel/rtlil.cc | 3 ++- kernel/rtlil.h | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 4a7bf79b2..c01cde61a 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -64,9 +64,10 @@ void RTLIL::IdString::prepopulate() { int size = static_cast(RTLIL::StaticId::STATIC_ID_END); global_id_storage_.reserve(size); - RTLIL::IdString::global_id_storage_.push_back({const_cast(""), 0}); global_id_index_.reserve(size); global_refcount_storage_.resize(size, 1); + RTLIL::IdString::global_id_index_.insert({"", 0}); + RTLIL::IdString::global_id_storage_.push_back({const_cast(""), 0}); #define X(N) populate("\\" #N); #include "kernel/constids.inc" #undef X diff --git a/kernel/rtlil.h b/kernel/rtlil.h index d570e39a3..47ab6f06c 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -236,9 +236,6 @@ struct RTLIL::IdString ensure_prepopulated(); - if (p.empty()) - return 0; - log_assert(p[0] == '$' || p[0] == '\\'); for (char ch : p) if ((unsigned)ch <= (unsigned)' ')