Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions mlir/lib/CAPI/Dialect/LLVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,8 @@ MlirAttribute mlirLLVMDIExpressionAttrGet(MlirContext ctx, intptr_t nOperations,

return wrap(DIExpressionAttr::get(
unwrap(ctx),
llvm::map_to_vector(
unwrapList(nOperations, operations, attrStorage),
[](Attribute a) { return cast<DIExpressionElemAttr>(a); })));
llvm::map_to_vector(unwrapList(nOperations, operations, attrStorage),
llvm::CastTo<DIExpressionElemAttr>)));
}

MlirAttribute mlirLLVMDINullTypeAttrGet(MlirContext ctx) {
Expand Down Expand Up @@ -202,7 +201,7 @@ MlirAttribute mlirLLVMDICompositeTypeAttrGet(
cast<DIExpressionAttr>(unwrap(allocated)),
cast<DIExpressionAttr>(unwrap(associated)),
llvm::map_to_vector(unwrapList(nElements, elements, elementsStorage),
[](Attribute a) { return cast<DINodeAttr>(a); })));
llvm::CastTo<DINodeAttr>)));
}

MlirAttribute mlirLLVMDIDerivedTypeAttrGet(
Expand Down Expand Up @@ -308,7 +307,7 @@ MlirAttribute mlirLLVMDISubroutineTypeAttrGet(MlirContext ctx,
return wrap(DISubroutineTypeAttr::get(
unwrap(ctx), callingConvention,
llvm::map_to_vector(unwrapList(nTypes, types, attrStorage),
[](Attribute a) { return cast<DITypeAttr>(a); })));
llvm::CastTo<DITypeAttr>)));
}

MlirAttribute mlirLLVMDISubprogramAttrGetRecSelf(MlirAttribute recId) {
Expand Down Expand Up @@ -338,10 +337,10 @@ MlirAttribute mlirLLVMDISubprogramAttrGet(
cast<DISubroutineTypeAttr>(unwrap(type)),
llvm::map_to_vector(
unwrapList(nRetainedNodes, retainedNodes, nodesStorage),
[](Attribute a) { return cast<DINodeAttr>(a); }),
llvm::CastTo<DINodeAttr>),
llvm::map_to_vector(
unwrapList(nAnnotations, annotations, annotationsStorage),
[](Attribute a) { return cast<DINodeAttr>(a); })));
llvm::CastTo<DINodeAttr>)));
}

MlirAttribute mlirLLVMDISubprogramAttrGetScope(MlirAttribute diSubprogram) {
Expand Down Expand Up @@ -398,7 +397,7 @@ MlirAttribute mlirLLVMDIImportedEntityAttrGet(
cast<DINodeAttr>(unwrap(entity)), cast<DIFileAttr>(unwrap(file)), line,
cast<StringAttr>(unwrap(name)),
llvm::map_to_vector(unwrapList(nElements, elements, elementsStorage),
[](Attribute a) { return cast<DINodeAttr>(a); })));
llvm::CastTo<DINodeAttr>)));
}

MlirAttribute mlirLLVMDIAnnotationAttrGet(MlirContext ctx, MlirAttribute name,
Expand Down
4 changes: 1 addition & 3 deletions mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,7 @@ void CastOp::getCanonicalizationPatterns(RewritePatternSet &results,
RankedTensorType ConcatOp::inferResultType(int64_t dim, TypeRange inputTypes) {
assert(!inputTypes.empty() && "cannot concatenate 0 tensors");
auto tensorTypes =
llvm::to_vector<4>(llvm::map_range(inputTypes, [](Type type) {
return llvm::cast<RankedTensorType>(type);
}));
llvm::map_to_vector<4>(inputTypes, llvm::CastTo<RankedTensorType>);
int64_t concatRank = tensorTypes[0].getRank();

// The concatenation dim must be in the range [0, rank).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1495,8 +1495,7 @@ transform::detail::checkApplyToOne(Operation *transformOp,

template <typename T>
static SmallVector<T> castVector(ArrayRef<transform::MappedValue> range) {
return llvm::to_vector(llvm::map_range(
range, [](transform::MappedValue value) { return cast<T>(value); }));
return llvm::map_to_vector(range, llvm::CastTo<T>);
}

void transform::detail::setApplyToOneResults(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,7 @@ static SmallVector<Value> computeDistributedCoordinatesForMatrixOp(
SmallVector<OpFoldResult> ofrVec = xegpu::addWithRightAligned(
rewriter, loc, getAsOpFoldResult(maybeCoords.value()[0]),
getAsOpFoldResult(origOffsets));
newCoods = llvm::to_vector(llvm::map_range(
ofrVec, [&](OpFoldResult ofr) -> Value { return cast<Value>(ofr); }));
newCoods = llvm::map_to_vector(ofrVec, llvm::CastTo<Value>);
return newCoods;
}

Expand Down
3 changes: 1 addition & 2 deletions mlir/lib/IR/TypeUtilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ LogicalResult mlir::verifyCompatibleDims(ArrayRef<int64_t> dims) {
/// have compatible dimensions. Dimensions are compatible if all non-dynamic
/// dims are equal. The element type does not matter.
LogicalResult mlir::verifyCompatibleShapes(TypeRange types) {
auto shapedTypes = llvm::map_to_vector<8>(
types, [](auto type) { return llvm::dyn_cast<ShapedType>(type); });
auto shapedTypes = llvm::map_to_vector<8>(types, llvm::DynCastTo<ShapedType>);
// Return failure if some, but not all are not shaped. Return early if none
// are shaped also.
if (llvm::none_of(shapedTypes, [](auto t) { return t; }))
Expand Down
Loading