Skip to content

Commit

Permalink
[mlir] Use llvm::is_contained (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Jan 13, 2024
1 parent 6bd488d commit 8e8bbbd
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ static bool isReachable(Block *from, Block *to, ArrayRef<Block *> except) {
worklist.push_back(succ);
while (!worklist.empty()) {
Block *next = worklist.pop_back_val();
if (llvm::find(except, next) != except.end())
if (llvm::is_contained(except, next))
continue;
if (next == to)
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,7 @@ transform::PadOp::apply(transform::TransformRewriter &rewriter,
if (options.copyBackOp != LinalgPaddingOptions::CopyBackOp::None) {
for (Value v : replacements) {
Operation *copyBackOp = v.getDefiningOp();
if (llvm::find(copyBackOps, copyBackOp) == copyBackOps.end())
if (!llvm::is_contained(copyBackOps, copyBackOp))
copyBackOps.push_back(copyBackOp);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ struct LinalgOpInterface
if (!isa<RankedTensorType, MemRefType>(operand.get().getType()))
continue;
// Only consider operands in `opOperands`.
if (llvm::find(opOperands, &operand) == opOperands.end())
if (!llvm::is_contained(opOperands, &operand))
continue;
// TODO: This could be generalized to other indexing maps. (All indexing
// must be the same.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ Value linalg::bufferizeToAllocation(
// bufferize out-of-place.
SmallVector<OpOperand *> outOfPlaceOperands, resultUses;
auto addOutOfPlaceOperand = [&](OpOperand *operand) {
if (llvm::find(outOfPlaceOperands, operand) == outOfPlaceOperands.end())
if (!llvm::is_contained(outOfPlaceOperands, operand))
outOfPlaceOperands.push_back(operand);
};
for (OpResult result : tensorResults) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ struct MaskOpInterface
SmallVector<Value> newReturnValues(maskOp->getNumResults(), Value());
SmallVector<Value> newYieldedValues;
for (const auto &it : llvm::enumerate(yieldOp.getOperands())) {
if (llvm::find(maskedOp->getOpResults(), it.value()) !=
maskedOp->getOpResults().end()) {
if (llvm::is_contained(maskedOp->getOpResults(), it.value())) {
newYieldedValues.push_back(it.value());
} else {
// This used to be a tensor result of the masked op, but is now a memref
Expand Down

0 comments on commit 8e8bbbd

Please sign in to comment.