Avoid unnecessary copy of a potential large constant value.
authorHenner Zeller <h.zeller@acm.org>
Mon, 6 Jun 2022 20:50:32 +0000 (13:50 -0700)
committerLofty <dan.ravensloft@gmail.com>
Thu, 9 Jun 2022 15:05:51 +0000 (16:05 +0100)
The local variable is used just to iterate through the values, so
a const reference is all we need.

passes/fsm/fsmdata.h

index 4ba3b4e4f5da23239ef32d337098c0f722ff6017..97371efabc82d08b4471e1f30614599f85c45906 100644 (file)
@@ -91,8 +91,8 @@ struct FsmData
                if (reset_state < 0 || reset_state >= state_num)
                        reset_state = -1;
 
-               RTLIL::Const state_table = cell->parameters[ID::STATE_TABLE];
-               RTLIL::Const trans_table = cell->parameters[ID::TRANS_TABLE];
+               const RTLIL::Const &state_table = cell->parameters[ID::STATE_TABLE];
+               const RTLIL::Const &trans_table = cell->parameters[ID::TRANS_TABLE];
 
                for (int i = 0; i < state_num; i++) {
                        RTLIL::Const state_code;