diff --git a/compiler/plugins/input/StableHLO/Conversion/Preprocessing/StableHLOToStableHLO.cpp b/compiler/plugins/input/StableHLO/Conversion/Preprocessing/StableHLOToStableHLO.cpp index 7251188e0b0a..c67ceb8e5bae 100644 --- a/compiler/plugins/input/StableHLO/Conversion/Preprocessing/StableHLOToStableHLO.cpp +++ b/compiler/plugins/input/StableHLO/Conversion/Preprocessing/StableHLOToStableHLO.cpp @@ -921,9 +921,9 @@ struct ScatterMaterializeInsertedDim final } } - llvm::ArrayRef toInsertDims = + auto toInsertDims = llvm::ArrayRef(isInsertDims).drop_front(frontInsertedDims); - if (!llvm::any_of(toInsertDims, [](auto d) { return d; })) { + if (llvm::none_of(toInsertDims, [](bool d) { return d; })) { return rewriter.notifyMatchFailure(op, "no dimensions to insert"); } @@ -931,7 +931,7 @@ struct ScatterMaterializeInsertedDim final SmallVector reassociationMap; reassociationMap.push_back({rewriter.getAffineDimExpr(0)}); - for (auto it : llvm::enumerate(llvm::ArrayRef(toInsertDims))) { + for (auto it : llvm::enumerate(toInsertDims)) { if (!it.value()) { reassociationMap.push_back({}); } diff --git a/compiler/src/iree/compiler/Bindings/Native/Transforms/WrapEntryPoints.cpp b/compiler/src/iree/compiler/Bindings/Native/Transforms/WrapEntryPoints.cpp index 0fb8ba7e0375..2aa6f8bbc35a 100644 --- a/compiler/src/iree/compiler/Bindings/Native/Transforms/WrapEntryPoints.cpp +++ b/compiler/src/iree/compiler/Bindings/Native/Transforms/WrapEntryPoints.cpp @@ -413,7 +413,7 @@ static void formatIOAttr(DictionaryAttr attrs, llvm::raw_ostream &os) { auto shouldIncludeAttr = [](const NamedAttribute &attr) { return attr.getName().getValue() != "iree.abi.name"; }; - if (!llvm::any_of(attrs, shouldIncludeAttr)) { + if (llvm::none_of(attrs, shouldIncludeAttr)) { return; } os << " {"; diff --git a/compiler/src/iree/compiler/Codegen/Common/DecomposePackUnPackOps.cpp b/compiler/src/iree/compiler/Codegen/Common/DecomposePackUnPackOps.cpp index 736e69212536..cce497024012 100644 --- a/compiler/src/iree/compiler/Codegen/Common/DecomposePackUnPackOps.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/DecomposePackUnPackOps.cpp @@ -344,9 +344,8 @@ static LogicalResult isUnpaddedAndAtBoundary(Operation *op) { // If all consumers are dispatch tensor stores, then the `op` is decomposable // if it is an UnPackOp. if (isa(op) && - llvm::all_of(op->getUsers(), [&](Operation *user) { - return isa(user); - })) { + llvm::all_of(op->getUsers(), + llvm::IsaPred)) { return success(); } return failure(); diff --git a/compiler/src/iree/compiler/Codegen/Common/MaterializeEncodingPatterns.cpp b/compiler/src/iree/compiler/Codegen/Common/MaterializeEncodingPatterns.cpp index b4db56291403..b87bfc53e342 100644 --- a/compiler/src/iree/compiler/Codegen/Common/MaterializeEncodingPatterns.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/MaterializeEncodingPatterns.cpp @@ -734,7 +734,7 @@ void populateMaterializeEncodingPatterns( return resultType == typeConverter.convertType(resultType); }); target.addDynamicallyLegalOp([](func::ReturnOp returnOp) { - return !llvm::any_of(returnOp.getOperandTypes(), + return llvm::none_of(returnOp.getOperandTypes(), isRankedTensorTypeWithEncoding); }); diff --git a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp index 5af5331db67f..ac26d8146758 100644 --- a/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp +++ b/compiler/src/iree/compiler/Codegen/Common/TransformExtensions/CommonExtensions.cpp @@ -423,9 +423,7 @@ static LogicalResult rewriteForallToWorkgroup(RewriterBase &rewriter, } SmallVector blockMapping = llvm::to_vector(forallOp.getMapping()->getValue()); - if (llvm::any_of(blockMapping, [](Attribute map) { - return !isa(map); - })) { + if (!llvm::all_of(blockMapping, llvm::IsaPred)) { return forallOp->emitError("mapping must be #gpu.block"); } diff --git a/compiler/src/iree/compiler/Codegen/Dialect/GPU/Transforms/Transforms.cpp b/compiler/src/iree/compiler/Codegen/Dialect/GPU/Transforms/Transforms.cpp index 190a1c27e401..8f95eed4c316 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/GPU/Transforms/Transforms.cpp +++ b/compiler/src/iree/compiler/Codegen/Dialect/GPU/Transforms/Transforms.cpp @@ -485,9 +485,8 @@ fuseNestedLaneAndWarpForalls(RewriterBase &rewriter, scf::ForallOp warpForallOp, scf::ForallOp laneForallOp) { // Verify mappings. if (!warpForallOp.getMapping() || - !llvm::all_of(*warpForallOp.getMapping(), [](Attribute mappingAttr) { - return isa(mappingAttr); - })) { + !llvm::all_of(*warpForallOp.getMapping(), + llvm::IsaPred)) { return rewriter.notifyMatchFailure(warpForallOp, "not a warp forall op"); } if (!laneForallOp.getMapping() || laneForallOp.getMapping()->size() != 1 || diff --git a/compiler/src/iree/compiler/Codegen/Dialect/VectorExt/IR/VectorExtAttrs.cpp b/compiler/src/iree/compiler/Codegen/Dialect/VectorExt/IR/VectorExtAttrs.cpp index cffd8cf605c4..344026ded253 100644 --- a/compiler/src/iree/compiler/Codegen/Dialect/VectorExt/IR/VectorExtAttrs.cpp +++ b/compiler/src/iree/compiler/Codegen/Dialect/VectorExt/IR/VectorExtAttrs.cpp @@ -303,9 +303,7 @@ NestedLayoutAttr::getRecombinedLayout(ArrayRef layouts, ArrayRef maps, AffineMap resultMap) { constexpr int64_t kInvalid = -1; - if (llvm::any_of(layouts, [](VectorLayoutInterface layout) { - return !isa(layout); - })) { + if (!llvm::all_of(layouts, llvm::IsaPred)) { return NestedLayoutAttr(); } MLIRContext *context = resultMap.getContext(); diff --git a/compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp b/compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp index bbd2f35d5af9..51158f9939d4 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp +++ b/compiler/src/iree/compiler/Codegen/LLVMCPU/DispatchABI.cpp @@ -798,7 +798,7 @@ MemRefDescriptor HALDispatchABI::loadBinding(Operation *forOp, int64_t ordinal, // requested range is valid. auto [strides, offset] = memRefType.getStridesAndOffset(); if (memRefType.hasStaticShape() && - !llvm::any_of(strides, ShapedType::isDynamic) && + llvm::none_of(strides, ShapedType::isDynamic) && ShapedType::isStatic(offset)) { return MemRefDescriptor::fromStaticShape(builder, loc, *typeConverter, memRefType, basePtrValue); diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/ConvertToLLVM.cpp b/compiler/src/iree/compiler/Codegen/LLVMGPU/ConvertToLLVM.cpp index 4fa209a2aa7c..7f44dd67bcfe 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/ConvertToLLVM.cpp +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/ConvertToLLVM.cpp @@ -408,7 +408,7 @@ struct ConvertIREEBindingSubspanOp final auto [strides, offset] = memrefType.getStridesAndOffset(); if (memrefType.hasStaticShape() && - !llvm::any_of(strides, ShapedType::isDynamic) && + llvm::none_of(strides, ShapedType::isDynamic) && ShapedType::isStatic(offset)) { auto desc = MemRefDescriptor::fromStaticShape( rewriter, loc, *getTypeConverter(), memrefType, llvmBufferBasePtr); diff --git a/compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp b/compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp index 5b84dd181b25..d3f8639a497d 100644 --- a/compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp +++ b/compiler/src/iree/compiler/Codegen/LLVMGPU/Passes.cpp @@ -403,9 +403,8 @@ LogicalResult isAtBoundary(Operation *op) { return success(); } } else if (isa(op)) { - if (llvm::all_of(op->getUsers(), [](Operation *user) { - return isa(user); - })) { + if (llvm::all_of(op->getUsers(), + llvm::IsaPred)) { return success(); } } diff --git a/compiler/src/iree/compiler/Codegen/Transforms/Transforms.cpp b/compiler/src/iree/compiler/Codegen/Transforms/Transforms.cpp index 8165a7743a74..c49671bb9c5e 100644 --- a/compiler/src/iree/compiler/Codegen/Transforms/Transforms.cpp +++ b/compiler/src/iree/compiler/Codegen/Transforms/Transforms.cpp @@ -661,9 +661,8 @@ struct FoldSplitReductionForallWithWorkgroupForall } std::optional workgroupMapping = workgroupLoop.getMapping(); if (!workgroupMapping || - llvm::any_of(workgroupMapping->getValue(), [](Attribute attr) { - return !isa(attr); - })) { + !llvm::all_of(workgroupMapping->getValue(), + llvm::IsaPred)) { return rewriter.notifyMatchFailure( workgroupLoop, "nested loop is not a workgroup mapping loop"); } diff --git a/compiler/src/iree/compiler/Dialect/Encoding/IR/EncodingAttrs.cpp b/compiler/src/iree/compiler/Dialect/Encoding/IR/EncodingAttrs.cpp index 3cdde7c627c9..80cb384caaaf 100644 --- a/compiler/src/iree/compiler/Dialect/Encoding/IR/EncodingAttrs.cpp +++ b/compiler/src/iree/compiler/Dialect/Encoding/IR/EncodingAttrs.cpp @@ -229,9 +229,7 @@ static FailureOr getComposedAffineMap(Attribute attr) { return AffineMap(); } // All entries should have type `AffineMapAttr`. - if (!llvm::all_of(mapsAttr, [](Attribute attr) { - return isa(attr); - })) { + if (!llvm::all_of(mapsAttr, llvm::IsaPred)) { return failure(); } AffineMap map = diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/ConvertRegionToWorkgroups.cpp b/compiler/src/iree/compiler/Dialect/Flow/Transforms/ConvertRegionToWorkgroups.cpp index 133ed3bea247..f1214d07f4e2 100644 --- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/ConvertRegionToWorkgroups.cpp +++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/ConvertRegionToWorkgroups.cpp @@ -101,9 +101,10 @@ rewriteFlowDispatchRegionToFlowDispatchWorkgroups( llvm::SetVector argumentsSet; mlir::getUsedValuesDefinedAbove(region, argumentsSet); // Unranked tensors are not supported. - assert(!llvm::any_of(argumentsSet, [](Value v) { - return isa(v.getType()); - }) && "unranked tensors are not supported"); + assert(llvm::none_of( + argumentsSet, + [](Value v) { return isa(v.getType()); }) && + "unranked tensors are not supported"); // Compute dimensions of tensor args. SmallVector argumentDims; diff --git a/compiler/src/iree/compiler/Dialect/Flow/Transforms/RegionOpUtils.cpp b/compiler/src/iree/compiler/Dialect/Flow/Transforms/RegionOpUtils.cpp index 9e461995781a..b023712db9b6 100644 --- a/compiler/src/iree/compiler/Dialect/Flow/Transforms/RegionOpUtils.cpp +++ b/compiler/src/iree/compiler/Dialect/Flow/Transforms/RegionOpUtils.cpp @@ -643,9 +643,8 @@ FailureOr hoistOutOfDispatch(RewriterBase &rewriter, return producer && producer->getParentOfType(); })) { rewriter.setInsertionPoint(dispatchRegionOp); - } else if (llvm::all_of(op->getUsers(), [&](Operation *user) { - return isa(user); - })) { + } else if (llvm::all_of(op->getUsers(), + llvm::IsaPred)) { rewriter.setInsertionPointAfter(dispatchRegionOp); } else { return rewriter.notifyMatchFailure( diff --git a/compiler/src/iree/compiler/Dialect/Stream/Transforms/PropagateTimepoints.cpp b/compiler/src/iree/compiler/Dialect/Stream/Transforms/PropagateTimepoints.cpp index 3e51b04f75b4..ace1ef6ac0bd 100644 --- a/compiler/src/iree/compiler/Dialect/Stream/Transforms/PropagateTimepoints.cpp +++ b/compiler/src/iree/compiler/Dialect/Stream/Transforms/PropagateTimepoints.cpp @@ -254,7 +254,7 @@ static void expandRegion(Region ®ion, bool canModifyEntryBlock, // Update all block arguments. auto timepointType = IREE::Stream::TimepointType::get(region.getContext()); for (auto &block : region.getBlocks()) { - if (!llvm::any_of(block.getArgumentTypes(), isResourceType)) { + if (llvm::none_of(block.getArgumentTypes(), isResourceType)) { continue; } if (block.isEntryBlock() && !canModifyEntryBlock) { diff --git a/compiler/src/iree/compiler/Dialect/Util/Transforms/PropagateSubranges.cpp b/compiler/src/iree/compiler/Dialect/Util/Transforms/PropagateSubranges.cpp index bacff11291e6..c6fffa1f66f1 100644 --- a/compiler/src/iree/compiler/Dialect/Util/Transforms/PropagateSubranges.cpp +++ b/compiler/src/iree/compiler/Dialect/Util/Transforms/PropagateSubranges.cpp @@ -230,7 +230,7 @@ static void expandRegion(Region ®ion, bool canModifyEntryBlock, // Update all block arguments. auto indexType = IndexType::get(region.getContext()); for (auto &block : region.getBlocks()) { - if (!llvm::any_of(block.getArgumentTypes(), isResourceType)) { + if (llvm::none_of(block.getArgumentTypes(), isResourceType)) { continue; } diff --git a/compiler/src/iree/compiler/DispatchCreation/FormDispatchRegions.cpp b/compiler/src/iree/compiler/DispatchCreation/FormDispatchRegions.cpp index 9df5a62a2d96..370fd631b096 100644 --- a/compiler/src/iree/compiler/DispatchCreation/FormDispatchRegions.cpp +++ b/compiler/src/iree/compiler/DispatchCreation/FormDispatchRegions.cpp @@ -737,7 +737,7 @@ isFusableWithConsumer(OpOperand &fusedOperand, const FusionTracker &tracker, continue; } if (isa(producer) && - !llvm::any_of( + llvm::none_of( consumerDstOp.getDpsInitsMutable(), [&](OpOperand &initOperand) { return canUseInOperandAsInitOperand(inputOperand, &initOperand); })) { @@ -979,9 +979,8 @@ decideFusableLinalgOps(Region ®ion, DominanceInfo const &dominanceInfo, // by the `isClonableIntoDispatchOp` call above, but for now this is done // as a point fix. if (IREE::LinalgExt::isGatherlikeOp(&op) && - llvm::all_of(op.getUsers(), [](Operation *op) { - return isa(op); - })) { + llvm::all_of(op.getUsers(), + llvm::IsaPred)) { continue; } diff --git a/compiler/src/iree/compiler/DispatchCreation/FuseHorizontalContractions.cpp b/compiler/src/iree/compiler/DispatchCreation/FuseHorizontalContractions.cpp index ed03dc8891ea..68315e478288 100644 --- a/compiler/src/iree/compiler/DispatchCreation/FuseHorizontalContractions.cpp +++ b/compiler/src/iree/compiler/DispatchCreation/FuseHorizontalContractions.cpp @@ -253,7 +253,7 @@ static bool isHorizontalToGroup(Operation *op, llvm::SetVector slice; [[maybe_unused]] LogicalResult result = getBackwardSlice(op, &slice, options); assert(result.succeeded()); - return !llvm::any_of(currGroup, [&](Operation *groupedOp) { + return llvm::none_of(currGroup, [&](Operation *groupedOp) { return slice.contains(groupedOp); }); } diff --git a/compiler/src/iree/compiler/GlobalOptimization/ExpandTensorShapes.cpp b/compiler/src/iree/compiler/GlobalOptimization/ExpandTensorShapes.cpp index d52968c0b53a..e2b900ade36e 100644 --- a/compiler/src/iree/compiler/GlobalOptimization/ExpandTensorShapes.cpp +++ b/compiler/src/iree/compiler/GlobalOptimization/ExpandTensorShapes.cpp @@ -213,7 +213,7 @@ static void expandRegion(Region ®ion, SymbolTable &symbolTable, // Update all block arguments. auto indexType = IndexType::get(region.getContext()); for (auto &block : region.getBlocks()) { - if (!llvm::any_of(block.getArgumentTypes(), isDynamicTensor)) { + if (llvm::none_of(block.getArgumentTypes(), isDynamicTensor)) { continue; }