Skip to content

Commit

Permalink
[NFC] Checking the number of input and output locations for modules w…
Browse files Browse the repository at this point in the history
…as dead code. Producing those lists was driven by the number of such ports, so testing that you got the right number was just checking the loop bounds that produced it. the get(In|Out)put* functions are inefficient and need to go away, but this saves 11.5 minutes in large designs. We also save a minute and a half pre-sizing a small vector.
  • Loading branch information
darthscsi committed Mar 10, 2024
1 parent c8ad1d6 commit eb5900a
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/Dialect/HW/HWOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1077,14 +1077,6 @@ static LogicalResult verifyModuleCommon(HWModuleLike module) {

auto moduleType = module.getHWModuleType();

auto argLocs = module.getInputLocs();
if (argLocs.size() != moduleType.getNumInputs())
return module->emitOpError("incorrect number of argument locations");

auto resultLocs = module.getOutputLocs();
if (resultLocs.size() != moduleType.getNumOutputs())
return module->emitOpError("incorrect number of result locations");

SmallPtrSet<Attribute, 4> paramNames;

// Check parameter default values are sensible.
Expand Down Expand Up @@ -1205,6 +1197,7 @@ static SmallVector<Location> getAllPortLocs(ModTy module) {
auto locs = module.getPortLocs();
if (locs) {
SmallVector<Location> retval;
retval.reserve(locs->size());
for (auto l : *locs)
retval.push_back(cast<Location>(l));
// Either we have a length of 0 or the correct length
Expand Down

0 comments on commit eb5900a

Please sign in to comment.