Lines Matching defs:loop
46 /// Replace `loop` with a new loop that has a different init operand at
47 /// position `index`. The body of this loop is moved over to the new loop.
50 /// `newYieldValue` is the replacement yield value of the loop at position
53 scf::ForOp loop,
58 rewriter.setInsertionPoint(loop.getOperation());
59 auto inits = llvm::to_vector(loop.getInits());
66 loop.getLoc(), loop.getLowerBound(), loop.getUpperBound(), loop.getStep(),
70 auto yieldOp = cast<scf::YieldOp>(loop.getBody()->getTerminator());
73 // Move the loop body to the new op.
74 rewriter.mergeBlocks(loop.getBody(), newLoop.getBody(),
77 // Replace the old loop.
78 rewriter.replaceOp(loop.getOperation(), newLoop->getResults());
83 // operations. This function transforms a loop like this:
102 // First move loop invariant ops outside of their loop. This needs to be
111 auto loop = dyn_cast<scf::ForOp>(extractOp->getParentOp());
112 if (!loop)
120 // Check that the blockArg is an iter_arg of the loop.
121 OpOperand *initArg = loop.getTiedLoopInit(blockArg);
130 unsigned index = blockArg.getArgNumber() - loop.getNumInductionVars();
132 // Check that the loop yields a broadcast that has just one use.
134 loop.getTiedLoopYieldedValue(blockArg)->get().getDefiningOp();
145 // The position of the extract must be defined outside of the loop if
148 if (!loop.isDefinedOutsideOfLoop(operand))
154 loop.moveOutOfLoop(extractOp);
155 rewriter.moveOpAfter(broadcast, loop);
158 rewriter, loop, extractOp.getResult(), index, broadcast.getSource());
160 LLVM_DEBUG(DBGS() << "New loop: " << newLoop << "\n");
173 LoopLikeOpInterface loop) {
195 if (!loop->isAncestor(user))
207 // First move loop invariant ops outside of their loop. This needs to be
214 // a potentially zero trip count loop may cause a vector transfer to be
223 // If loop bounds cannot be found, assume possibly zero trip count.
229 // than the minUb, then the loop will not have zero trip count.
255 auto loop = dyn_cast<LoopLikeOpInterface>(transferRead->getParentOp());
258 if (!isa_and_nonnull<scf::ForOp, affine::AffineForOp>(loop))
261 if (verifyNonZeroTrip && !definiteNonZeroTripCountLoops.contains(loop)) {
262 LLVM_DEBUG(DBGS() << "Loop may have zero trip count: " << *loop
284 // All operands of the TransferRead must be defined outside of the loop.
286 if (!loop.isDefinedOutsideOfLoop(operand))
294 if (noAliasingUseInLoop(transferRead, loop))
295 loop.moveOutOfLoop(transferRead);
307 // 3. no other operations in the loop access the same memref except
325 DominanceInfo dom(loop);
329 if (!loop->isAncestor(use.getOwner()))
356 loop.moveOutOfLoop(transferRead);
359 transferWrite->moveAfter(loop);
361 // Rewrite `loop` with new yields by cloning and erase the original loop.
368 auto maybeNewLoop = loop.replaceWithAdditionalYields(
377 // Need to interrupt and restart because erasing the loop messes up