diff --git a/lib/Dialect/FIRRTL/FIRRTLOps.cpp b/lib/Dialect/FIRRTL/FIRRTLOps.cpp index f421dc56bb..9f4218337a 100644 --- a/lib/Dialect/FIRRTL/FIRRTLOps.cpp +++ b/lib/Dialect/FIRRTL/FIRRTLOps.cpp @@ -50,6 +50,11 @@ removeElementsAtIndices(ArrayRef input, ArrayRef 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 result;