From 86d8dd6224628609b703f811e41dd0d282d8a6d0 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 12 Sep 2025 04:59:20 +0000 Subject: [PATCH] Add a moving assignment operator for IdString to avoid refcount churn --- kernel/rtlil.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/rtlil.h b/kernel/rtlil.h index a24a82f55..794cabd70 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -339,6 +339,12 @@ struct RTLIL::IdString index_ = get_reference(rhs.index_); } + inline void operator=(IdString &&rhs) { + put_reference(index_); + index_ = rhs.index_; + rhs.index_ = 0; + } + inline void operator=(const char *rhs) { IdString id(rhs); *this = id;