From 2c7c0bb01e83ee65d152571ae5cc19641c7bb995 Mon Sep 17 00:00:00 2001 From: Prithayan Barua Date: Thu, 14 Mar 2024 09:15:42 -0700 Subject: [PATCH] Add a visited set --- lib/Dialect/FIRRTL/Transforms/InferReadWrite.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/Dialect/FIRRTL/Transforms/InferReadWrite.cpp b/lib/Dialect/FIRRTL/Transforms/InferReadWrite.cpp index 14824b74c10a..470caddf8a5c 100644 --- a/lib/Dialect/FIRRTL/Transforms/InferReadWrite.cpp +++ b/lib/Dialect/FIRRTL/Transforms/InferReadWrite.cpp @@ -363,9 +363,12 @@ struct InferReadWritePass : public InferReadWriteBase { return defOp; }; SmallVector stack; + llvm::SmallDenseSet 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;