54 forOp.getBody()->walk([&](Operation *op) {
58 ArrayRef<MemoryDependence> dependences = memoryAnalysis.
getDependences(op);
59 if (dependences.empty())
64 if (!hasDependence(memoryDep.dependenceType))
70 assert(succeeded(depInserted));
77 unsigned distance = *memoryDep.dependenceComponents.back().lb;
84 forOp.getBody()->walk([&](Operation *op) {
85 Block *thenBlock =
nullptr;
86 Block *elseBlock =
nullptr;
87 if (
auto ifOp = dyn_cast<scf::IfOp>(op)) {
88 thenBlock = ifOp.thenBlock();
89 elseBlock = ifOp.elseBlock();
90 }
else if (
auto ifOp = dyn_cast<AffineIfOp>(op)) {
91 thenBlock = ifOp.getThenBlock();
93 elseBlock = ifOp.getElseBlock();
95 return WalkResult::advance();
99 if (op->getNumResults() == 0)
100 return WalkResult::skip();
105 assert(succeeded(depInserted));
111 assert(succeeded(depInserted));
115 return WalkResult::advance();
120 auto *anchor = forOp.getBody()->getTerminator();
121 forOp.getBody()->walk([&](Operation *op) {
122 if (!isa<AffineStoreOp, memref::StoreOp>(op))
126 assert(succeeded(depInserted));
133 if (
unsigned nIterArgs = anchor->getNumOperands(); nIterArgs > 0) {
134 auto iterArgs = forOp.getRegionIterArgs();
135 for (
unsigned i = 0; i < nIterArgs; ++i) {
136 Operation *iterArgDefiner = anchor->getOperand(i).getDefiningOp();
141 for (Operation *iterArgUser : iterArgs[i].getUsers()) {
144 assert(succeeded(depInserted));
154 problems.insert(std::pair<Operation *, CyclicProblem>(forOp, problem));