25static FailureOr<llvm::SmallVector<Operation *>>
31 if (op->
getBlock() != user->getBlock())
33 opUsers.push_back(user);
50 operations.push_back(op);
56 if (isa<vector::LoadOp>(nextOp) || isa<vector::TransferReadOp>(nextOp)) {
57 operations.push_back(op);
61 nextOp = nextOp->getNextNode();
71 if (!llvm::is_contained(*users, nextOp))
80template <
typename producerOp>
98 prodsAllUsers.try_emplace(op, opUsers);
104 while ((nextOp = nextOp->getNextNode())) {
106 if (isa<vector::LoadOp>(nextOp) || isa<vector::TransferReadOp>(nextOp)) {
109 if (failed(nextUsers))
112 prodsAllUsers.try_emplace(nextOp, nextOpUsers);
116 for (
auto &entry : prodsAllUsers) {
119 if (llvm::is_contained(users, nextOp)) {
121 operations.push_back(operation);
122 prodsFirstUser.try_emplace(operation, nextOp);
127 prodsAllUsers.erase(op);
133 for (
auto &entry : prodsFirstUser) {
static bool checkLooping(Operation *op)
static FailureOr< llvm::SmallVector< Operation * > > getSameBlockUsers(Operation *op)
This is a value defined by a result of an operation.
Operation is the basic unit of execution within MLIR.
Block * getBlock()
Returns the operation block that contains this operation.
void moveBefore(Operation *existingOp)
Unlink this operation from its current block and insert it right before existingOp which may be in th...
result_range getResults()
A special type of RewriterBase that coordinates the application of a rewrite pattern on the current I...
void populateSinkVectorProducerOpsPatterns(RewritePatternSet &patterns)
Include the generated interface declarations.
const FrozenRewritePatternSet & patterns
Sink vector producers forward to reduce live ranges.
LogicalResult matchAndRewrite(producerOp op, PatternRewriter &rewriter) const override
OpRewritePattern(MLIRContext *context, PatternBenefit benefit=1, ArrayRef< StringRef > generatedNames={})