11 #include "mlir/IR/Operation.h"
12 #include "llvm/ADT/SmallSet.h"
14 using namespace circt;
17 SmallVector<Operation *> worklist;
19 worklist.push_back(initialOp);
20 while (!worklist.empty()) {
21 auto *op = worklist.pop_back_val();
24 for (
auto arg : op->getOperands())
25 if (
auto *argOp = arg.getDefiningOp())
26 if (handled.insert(argOp).second)
27 worklist.push_back(argOp);
void pruneUnusedOps(Operation *initialOp, Reduction &reduction)
Starting at the given op, traverse through it and its operands and erase operations that have no more...
The InstanceGraph op interface, see InstanceGraphInterface.td for more details.
An abstract reduction pattern.
void notifyOpErased(Operation *op)