Fix conditionals on obsolete --threads 0

Since we removed --threads 0 support, the 'threads()' option always
returns a value >= 1. Remove corresponding dead code.

Some of the coverage counters appear to use atomics even if the model is
single threaded. I'm under the impression this was a bug originally so
those ones I changed to use threads() > 1 instead.
This commit is contained in:
Geza Lore
2023-10-21 15:14:27 +01:00
parent cbc2f9eb32
commit d1c7875406
10 changed files with 16 additions and 23 deletions
+2 -7
View File
@@ -159,7 +159,7 @@ V3StringList V3HierBlock::commandArgs(bool forCMake) const {
opts.push_back(" --lib-create " + modp()->name()); // possibly mangled name
if (v3Global.opt.protectKeyProvided())
opts.push_back(" --protect-key " + v3Global.opt.protectKeyDefaulted());
opts.push_back(" --hierarchical-child " + cvtToStr(std::max(1, v3Global.opt.threads())));
opts.push_back(" --hierarchical-child " + cvtToStr(v3Global.opt.threads()));
const StrGParams gparamsStr = stringifyParams(gparams(), true);
for (StrGParams::const_iterator paramIt = gparamsStr.begin(); paramIt != gparamsStr.end();
@@ -227,9 +227,6 @@ void V3HierBlock::writeCommandArgsFile(bool forCMake) const {
for (const string& opt : commandOpts) *of << opt << "\n";
*of << hierBlockArgs().front() << "\n";
for (const auto& hierblockp : m_children) *of << hierblockp->hierBlockArgs().front() << "\n";
// Hierarchical blocks should not use multi-threading,
// but needs to be thread safe when top is multi-threaded.
if (v3Global.opt.threads() > 0) *of << "--threads 1\n";
*of << v3Global.opt.allArgsStringForHierBlock(false) << "\n";
}
@@ -425,9 +422,7 @@ void V3HierBlockPlan::writeCommandArgsFiles(bool forCMake) const {
if (v3Global.opt.protectKeyProvided()) {
*of << "--protect-key " << v3Global.opt.protectKeyDefaulted() << "\n";
}
if (v3Global.opt.threads() > 0) {
*of << "--threads " << cvtToStr(v3Global.opt.threads()) << "\n";
}
*of << "--threads " << cvtToStr(v3Global.opt.threads()) << "\n";
*of << (v3Global.opt.systemC() ? "--sc" : "--cc") << "\n";
*of << v3Global.opt.allArgsStringForHierBlock(true) << "\n";
}