Skip to content

Commit

Permalink
[FIRRTL] Fix iteration over set
Browse files Browse the repository at this point in the history
Fix incorrect iteration over a set to do operation erasure.  The order of
operations is operations is important to avoid erasing an op before all
its users are erased.  Avoid this with a SetVector.

h/t @dtzSiFive for identifying the problem/fix.

Signed-off-by: Schuyler Eldridge <[email protected]>
  • Loading branch information
seldridge committed Sep 13, 2024
1 parent d22b9cd commit d61cdc9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Dialect/FIRRTL/Transforms/LowerMemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ struct LowerMemoryPass
std::map<FirMemory, FMemModuleOp> memories;

/// A sequence of operations that should be erased later.
SmallPtrSet<Operation *, 32> operationsToErase;
SetVector<Operation *> operationsToErase;
};
} // end anonymous namespace

Expand Down

0 comments on commit d61cdc9

Please sign in to comment.