-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[mlir] Use llvm::copy (NFC) #168213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_20251115_clang_tidy_llvm-use-ranges
Nov 15, 2025
Merged
[mlir] Use llvm::copy (NFC) #168213
kazutakahirata
merged 1 commit into
llvm:main
from
kazutakahirata:cleanup_20251115_clang_tidy_llvm-use-ranges
Nov 15, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Identified with llvm-use-ranges.
Member
|
@llvm/pr-subscribers-mlir-gpu @llvm/pr-subscribers-mlir-affine Author: Kazu Hirata (kazutakahirata) ChangesIdentified with llvm-use-ranges. Full diff: https://github.com/llvm/llvm-project/pull/168213.diff 7 Files Affected:
diff --git a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
index 812043d1af0d9..949fc2db79809 100644
--- a/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
+++ b/mlir/lib/Analysis/Presburger/IntegerRelation.cpp
@@ -2265,11 +2265,11 @@ IntegerRelation::unionBoundingBox(const IntegerRelation &otherCst) {
newLb[d] = lbFloorDivisor;
newUb[d] = -lbFloorDivisor;
// Copy over the symbolic part + constant term.
- std::copy(minLb.begin(), minLb.end(), newLb.begin() + getNumDimVars());
+ llvm::copy(minLb, newLb.begin() + getNumDimVars());
std::transform(newLb.begin() + getNumDimVars(), newLb.end(),
newLb.begin() + getNumDimVars(),
std::negate<DynamicAPInt>());
- std::copy(maxUb.begin(), maxUb.end(), newUb.begin() + getNumDimVars());
+ llvm::copy(maxUb, newUb.begin() + getNumDimVars());
boundingLbs.emplace_back(newLb);
boundingUbs.emplace_back(newUb);
diff --git a/mlir/lib/CAPI/IR/BuiltinTypes.cpp b/mlir/lib/CAPI/IR/BuiltinTypes.cpp
index f5f4ed30219eb..e2e236ab4b074 100644
--- a/mlir/lib/CAPI/IR/BuiltinTypes.cpp
+++ b/mlir/lib/CAPI/IR/BuiltinTypes.cpp
@@ -536,7 +536,7 @@ MlirLogicalResult mlirMemRefTypeGetStridesAndOffset(MlirType type,
if (failed(memrefType.getStridesAndOffset(strides_, *offset)))
return mlirLogicalResultFailure();
- (void)std::copy(strides_.begin(), strides_.end(), strides);
+ (void)llvm::copy(strides_, strides);
return mlirLogicalResultSuccess();
}
diff --git a/mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp b/mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
index c942c0248fefd..b04e2d6d196dd 100644
--- a/mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
+++ b/mlir/lib/Dialect/Affine/Transforms/PipelineDataTransfer.cpp
@@ -82,7 +82,7 @@ static bool doubleBuffer(Value oldMemRef, AffineForOp forOp) {
ArrayRef<int64_t> oldShape = oldMemRefType.getShape();
SmallVector<int64_t, 4> newShape(1 + oldMemRefType.getRank());
newShape[0] = 2;
- std::copy(oldShape.begin(), oldShape.end(), newShape.begin() + 1);
+ llvm::copy(oldShape, newShape.begin() + 1);
return MemRefType::Builder(oldMemRefType).setShape(newShape).setLayout({});
};
diff --git a/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp b/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
index 9436f1c6cd9b0..161d97805f773 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
@@ -913,8 +913,7 @@ static Value replaceByPackingResult(RewriterBase &rewriter,
llvm_unreachable("loop independence prerequisite not met");
// offsets = [maybe_leading_ivs = originalLoopIvs, 0 .. 0].
- std::copy(loopIterationCounts.begin(), loopIterationCounts.end(),
- offsets.begin());
+ llvm::copy(loopIterationCounts, offsets.begin());
hoistedPackedTensor =
scf::getForInductionVarOwner(packingResult.clonedLoopIvs.front())
->getResult(0);
diff --git a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.h b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.h
index 3636f3f01adb5..46378b9823f27 100644
--- a/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.h
+++ b/mlir/lib/Dialect/SparseTensor/Transforms/Utils/SparseTensorIterator.h
@@ -197,7 +197,7 @@ class SparseIterator {
// Sets the iterate to the specified position.
void seek(ValueRange vals) {
assert(vals.size() == cursorValsCnt);
- std::copy(vals.begin(), vals.end(), cursorValsStorageRef.begin());
+ llvm::copy(vals, cursorValsStorageRef.begin());
// Now that the iterator is re-positioned, the coordinate becomes invalid.
crd = nullptr;
}
diff --git a/mlir/lib/Dialect/XeGPU/Utils/XeGPUUtils.cpp b/mlir/lib/Dialect/XeGPU/Utils/XeGPUUtils.cpp
index de9e09d427665..b0905c4e9203b 100644
--- a/mlir/lib/Dialect/XeGPU/Utils/XeGPUUtils.cpp
+++ b/mlir/lib/Dialect/XeGPU/Utils/XeGPUUtils.cpp
@@ -308,7 +308,7 @@ xegpu::extractVectorsWithShapeFromValue(OpBuilder &builder, Location loc,
int64_t rankDiff = srcShapeRank - targetShapeRank;
std::fill(adjustedTargetShape.begin(), adjustedTargetShape.begin() + rankDiff,
1);
- std::copy(shape.begin(), shape.end(), adjustedTargetShape.begin() + rankDiff);
+ llvm::copy(shape, adjustedTargetShape.begin() + rankDiff);
SmallVector<Value> result;
for (SmallVector<int64_t> offsets :
diff --git a/mlir/lib/Tools/PDLL/AST/Nodes.cpp b/mlir/lib/Tools/PDLL/AST/Nodes.cpp
index 5aa09375bc79d..4358cebf0e1e1 100644
--- a/mlir/lib/Tools/PDLL/AST/Nodes.cpp
+++ b/mlir/lib/Tools/PDLL/AST/Nodes.cpp
@@ -21,7 +21,7 @@ static StringRef copyStringWithNull(Context &ctx, StringRef str) {
return str;
char *data = ctx.getAllocator().Allocate<char>(str.size() + 1);
- std::copy(str.begin(), str.end(), data);
+ llvm::copy(str, data);
data[str.size()] = 0;
return StringRef(data, str.size());
}
|
kuhar
approved these changes
Nov 15, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
mlir:affine
mlir:core
MLIR Core Infrastructure
mlir:gpu
mlir:linalg
mlir:presburger
mlir:sparse
Sparse compiler in MLIR
mlir
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Identified with llvm-use-ranges.