File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
mlir/lib/Conversion/Normalize Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change 1515#include " mlir/Support/LLVM.h"
1616#include " llvm/ADT/Hashing.h"
1717
18+ #include < algorithm>
1819#include < iomanip>
1920#include < sstream>
2021
@@ -428,14 +429,19 @@ SetVector<int> NormalizePass::getOutputFootprint(
428429
429430 unsigned count = 0 ;
430431 for (Block &block : func.getRegion ()) {
431- for (Operation &innerOp : block) {
432- if (&innerOp == op) {
433- outputsVec.insert (count);
434- return outputsVec;
435- }
436- count++;
432+ if (auto it = std::find_if (
433+ block.begin (), block.end (),
434+ [op](Operation &innerOp) { return &innerOp == op; });
435+ it != block.end ()) {
436+ count += std::distance (block.begin (), it);
437+ outputsVec.insert (count);
438+ break ;
439+ } else {
440+ count += std::distance (block.begin (), block.end ());
437441 }
438442 }
443+
444+ return outputsVec;
439445 }
440446
441447 for (OpOperand &use : op->getUses ()) {
You can’t perform that action at this time.
0 commit comments