Skip to content

Commit

Permalink
Add a visited set
Browse files Browse the repository at this point in the history
  • Loading branch information
prithayan committed Mar 14, 2024
1 parent d6d9e35 commit 2c7c0bb
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Dialect/FIRRTL/Transforms/InferReadWrite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,12 @@ struct InferReadWritePass : public InferReadWriteBase<InferReadWritePass> {
return defOp;
};
SmallVector<Value> stack;
llvm::SmallDenseSet<Value> visited;
stack.push_back(wmodeDriver);
while (!stack.empty()) {
auto driver = stack.pop_back_val();
if (!visited.insert(driver).second)
continue;
auto *defOp = getDriverOp(driver);
if (!defOp)
continue;
Expand Down

0 comments on commit 2c7c0bb

Please sign in to comment.