mirror of https://github.com/llvm/circt.git
[FIRRTL] Fix FModuleOp::erasePorts failing on empty attr arrays
As an optimization, we use empty array attributes on module-like ops where none of the ports have an attribute set. The code in `erasePorts` assumes that all arrays have the same number of entries as the module has ports. This adds a special case that just passes through empty arrays (the optimized case).
This commit is contained in:
parent
3c98641554
commit
fc15900656
|
@ -50,6 +50,11 @@ removeElementsAtIndices(ArrayRef<T> input, ArrayRef<unsigned> indicesToDrop) {
|
|||
}
|
||||
#endif
|
||||
|
||||
// If the input is empty (which is an optimization we do for certain array
|
||||
// attributes), simply return an empty vector.
|
||||
if (input.empty())
|
||||
return {};
|
||||
|
||||
// Copy over the live chunks.
|
||||
size_t lastCopied = 0;
|
||||
SmallVector<T> result;
|
||||
|
|
Loading…
Reference in New Issue