[mlir] Use llvm::is_contained instead of llvm::all_of (NFC) (#145845)
llvm::is_contained is shorter than llvm::all_of plus a lambda.
This commit is contained in:
@@ -922,8 +922,7 @@ static bool isLoopInvariantIdx(LinalgOp &linalgOp, Value &val,
|
||||
// TODO: We could try analysing the corresponding affine map here.
|
||||
auto *block = linalgOp.getBlock();
|
||||
if (isa<BlockArgument>(val))
|
||||
return llvm::all_of(block->getArguments(),
|
||||
[&val](Value v) { return (v != val); });
|
||||
return !llvm::is_contained(block->getArguments(), val);
|
||||
|
||||
Operation *defOp = val.getDefiningOp();
|
||||
assert(defOp && "This is neither a block argument nor an operation result");
|
||||
@@ -982,8 +981,7 @@ static bool isContiguousLoadIdx(LinalgOp &linalgOp, Value &val,
|
||||
// TODO: We could try analysing the corresponding affine map here.
|
||||
auto *block = linalgOp.getBlock();
|
||||
if (isa<BlockArgument>(val))
|
||||
return llvm::all_of(block->getArguments(),
|
||||
[&val](Value v) { return (v != val); });
|
||||
return !llvm::is_contained(block->getArguments(), val);
|
||||
|
||||
Operation *defOp = val.getDefiningOp();
|
||||
assert(defOp && "This is neither a block argument nor an operation result");
|
||||
|
||||
@@ -929,7 +929,7 @@ std::pair<Operation *, Value> sparse_tensor::genCoIteration(
|
||||
ivs.push_back(uniIdx);
|
||||
|
||||
// Ensures all operands are valid.
|
||||
assert(llvm::all_of(ivs, [](Value v) { return v != nullptr; }));
|
||||
assert(!llvm::is_contained(ivs, nullptr));
|
||||
TypeRange types = ValueRange(ivs).getTypes();
|
||||
auto whileOp = builder.create<scf::WhileOp>(loc, types, ivs);
|
||||
|
||||
|
||||
@@ -321,8 +321,7 @@ Value vector::createReadOrMaskedRead(OpBuilder &builder, Location loc,
|
||||
ArrayRef<int64_t> inputVectorSizes,
|
||||
Value padValue,
|
||||
bool useInBoundsInsteadOfMasking) {
|
||||
assert(llvm::none_of(inputVectorSizes,
|
||||
[](int64_t s) { return s == ShapedType::kDynamic; }) &&
|
||||
assert(!llvm::is_contained(inputVectorSizes, ShapedType::kDynamic) &&
|
||||
"invalid input vector sizes");
|
||||
auto sourceShapedType = cast<ShapedType>(source.getType());
|
||||
auto sourceShape = sourceShapedType.getShape();
|
||||
|
||||
@@ -253,9 +253,8 @@ void DefGen::createParentWithTraits() {
|
||||
// method.
|
||||
std::string opAsmInterfaceTraitName =
|
||||
strfmt("::mlir::OpAsm{0}Interface::Trait", defType);
|
||||
if (def.genMnemonicAlias() && llvm::none_of(traitNames, [&](auto &traitName) {
|
||||
return traitName == opAsmInterfaceTraitName;
|
||||
})) {
|
||||
if (def.genMnemonicAlias() &&
|
||||
!llvm::is_contained(traitNames, opAsmInterfaceTraitName)) {
|
||||
defParent.addTemplateParam(opAsmInterfaceTraitName);
|
||||
}
|
||||
defCls.addParent(std::move(defParent));
|
||||
|
||||
Reference in New Issue
Block a user