@@ -38,9 +38,6 @@ struct NormalizePass : public impl::NormalizeBase<NormalizePass> {
3838private:
3939 // Random constant for hashing, so the state isn't zero.
4040 const uint64_t magicHashConstant = 0x6acaa36bef8325c5ULL ;
41- void
42- collectOutputOperations (Block &block,
43- SmallVector<Operation *, 16 > &outputs) const noexcept ;
4441 bool isOutput (Operation &op) const noexcept ;
4542 void reorderOperations (const SmallVector<Operation *, 16 > &outputs);
4643 void reorderOperation (Operation *used, Operation *user,
@@ -69,16 +66,14 @@ void NormalizePass::runOnOperation() {
6966
7067 ModuleOp module = getOperation ();
7168
72- for (auto &op : module .getOps ()) {
73- SmallVector<Operation *, 16 > outputs;
69+ SmallVector<Operation *, 16 > outputs;
70+ module .walk ([&](Operation *op) {
71+ if (isOutput (*op))
72+ outputs.push_back (op);
73+ });
7474
75- for (auto ®ion : op.getRegions ())
76- for (auto &block : region)
77- collectOutputOperations (block, outputs);
78-
79- reorderOperations (outputs);
80- renameOperations (outputs);
81- }
75+ reorderOperations (outputs);
76+ renameOperations (outputs);
8277}
8378
8479void NormalizePass::renameOperations (
@@ -384,13 +379,6 @@ void NormalizePass::reorderOperation(
384379 }
385380}
386381
387- void NormalizePass::collectOutputOperations (
388- Block &block, SmallVector<Operation *, 16 > &outputs) const noexcept {
389- for (auto &innerOp : block)
390- if (isOutput (innerOp))
391- outputs.emplace_back (&innerOp);
392- }
393-
394382// / The following Operations are termed as output:
395383// / - Terminator operations are outputs
396384// / - Any operation that implements MemoryEffectOpInterface and reports at
0 commit comments