mirror of https://github.com/YosysHQ/yosys.git
passes: opt_share: don't statically initialize mergeable_type_map
In 3d3779b037
this got turned from a
`std::map<std::string, std::string>` to `std::map<IdString, IdString>`.
Consequently, this exposed some initialization sequencing issues (#1361).
Only initialize the map when it's first used, to avoid these static issues.
This fixes #1361.
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
417f3fe6b1
commit
8d128ba6d0
|
@ -108,12 +108,13 @@ bool cell_supported(RTLIL::Cell *cell)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::map<IdString, IdString> mergeable_type_map{
|
||||
{ID($sub), ID($add)},
|
||||
};
|
||||
std::map<IdString, IdString> mergeable_type_map;
|
||||
|
||||
bool mergeable(RTLIL::Cell *a, RTLIL::Cell *b)
|
||||
{
|
||||
if (mergeable_type_map.empty()) {
|
||||
mergeable_type_map.insert({ID($sub), ID($add)});
|
||||
}
|
||||
auto a_type = a->type;
|
||||
if (mergeable_type_map.count(a_type))
|
||||
a_type = mergeable_type_map.at(a_type);
|
||||
|
|
Loading…
Reference in New Issue