-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[mlir] Use range constructors of *Set (NFC) #137563
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
[mlir] Use range constructors of *Set (NFC) #137563
Conversation
@llvm/pr-subscribers-mlir-async @llvm/pr-subscribers-mlir-core Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/137563.diff 9 Files Affected:
diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index e5f4ab57a9d88..5aebb19e3a86e 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -197,8 +197,7 @@ static bool dependsOnCarriedVals(Value value,
// Check that none of the operands of the operations in the backward slice are
// loop iteration arguments, and neither is the value itself.
- SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
- iterCarriedArgs.end());
+ SmallPtrSet<Value, 8> iterCarriedValSet(llvm::from_range, iterCarriedArgs);
if (iterCarriedValSet.contains(value))
return true;
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index 402be0f29e5c7..9b36bd964ef10 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -304,8 +304,8 @@ outlineExecuteOp(SymbolTable &symbolTable, ExecuteOp execute) {
cloneConstantsIntoTheRegion(execute.getBodyRegion());
// Collect all outlined function inputs.
- SetVector<mlir::Value> functionInputs(execute.getDependencies().begin(),
- execute.getDependencies().end());
+ SetVector<mlir::Value> functionInputs(llvm::from_range,
+ execute.getDependencies());
functionInputs.insert_range(execute.getBodyOperands());
getUsedValuesDefinedAbove(execute.getBodyRegion(), functionInputs);
diff --git a/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp b/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
index 89546da428fa2..a077f56f4f472 100644
--- a/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
@@ -133,8 +133,8 @@ struct CondBranchOpInterface
// We specifically need to update the ownerships of values that are retained
// in both dealloc operations again to get a combined 'Unique' ownership
// instead of an 'Unknown' ownership.
- SmallPtrSet<Value, 16> thenValues(thenTakenDeallocOp.getRetained().begin(),
- thenTakenDeallocOp.getRetained().end());
+ SmallPtrSet<Value, 16> thenValues(llvm::from_range,
+ thenTakenDeallocOp.getRetained());
SetVector<Value> commonValues;
for (Value val : elseTakenDeallocOp.getRetained()) {
if (thenValues.contains(val))
diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index 62dc1f13412d4..a64ec8d52daf0 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -267,7 +267,7 @@ gpu::GPUFuncOp mlir::outlineKernelFunc(gpu::LaunchOp launchOp,
llvm::SmallVectorImpl<Value> &operands) {
DenseSet<Value> inputOperandSet;
inputOperandSet.insert_range(operands);
- SetVector<Value> operandSet(operands.begin(), operands.end());
+ SetVector<Value> operandSet(llvm::from_range, operands);
auto funcOp = outlineKernelFuncImpl(launchOp, kernelFnName, operandSet);
for (auto operand : operandSet) {
if (!inputOperandSet.count(operand))
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index b20e6050fb4f8..a9b5c2a0f3c18 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -985,8 +985,7 @@ transform::FuseIntoContainingOp::apply(transform::TransformRewriter &rewriter,
// Helper function to find the next producer that should be fused. Take any
// producer that has a use inside the containing op.
- SetVector<Operation *> remainingProducers(producerOps.begin(),
- producerOps.end());
+ SetVector<Operation *> remainingProducers(llvm::from_range, producerOps);
auto getNextProducer = [&]() -> FailureOr<Operation *> {
for (const auto &it : enumerate(remainingProducers)) {
Operation *producerOp = it.value();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp b/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
index 0ddf03bf317e7..f2a64f5bf38a3 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
@@ -766,13 +766,12 @@ bubbleUpPackOpThroughExpandShape(tensor::ExpandShapeOp expandOp,
SmallVector<ReassociationIndices, 4> reassoc =
expandOp.getReassociationIndices();
ArrayRef<int64_t> packInnerDims = packOp.getInnerDimsPos();
- llvm::SetVector<int64_t> packDimsPos(packInnerDims.begin(),
- packInnerDims.end());
+ llvm::SetVector<int64_t> packDimsPos(llvm::from_range, packInnerDims);
for (auto [idx, indices] : llvm::enumerate(reassoc)) {
// For each expand_shape reassociation, figure out which dimensions get
// packed if any.
- llvm::SetVector<int64_t> expandDimPos(indices.begin(), indices.end());
+ llvm::SetVector<int64_t> expandDimPos(llvm::from_range, indices);
llvm::SetVector<int64_t> packedDims =
llvm::set_intersection(packDimsPos, expandDimPos);
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
index d564b4cc8af67..161c885b808b1 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
@@ -94,7 +94,7 @@ SmallVector<spirv::Capability, 0>
spirv::getRecursiveImpliedCapabilities(spirv::Capability cap) {
ArrayRef<spirv::Capability> directCaps = getDirectImpliedCapabilities(cap);
SetVector<spirv::Capability, SmallVector<spirv::Capability, 0>> allCaps(
- directCaps.begin(), directCaps.end());
+ llvm::from_range, directCaps);
// TODO: This is insufficient; find a better way to handle this
// (e.g., using static lists) if this turns out to be a bottleneck.
diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index 84d339a985c38..673743f22249a 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -2073,7 +2073,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Operation *> uniqued(operations.begin(), operations.end());
+ SetVector<Operation *> uniqued(llvm::from_range, operations);
results.set(llvm::cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
@@ -2087,7 +2087,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Attribute> uniqued(attrs.begin(), attrs.end());
+ SetVector<Attribute> uniqued(llvm::from_range, attrs);
results.setParams(cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
@@ -2103,7 +2103,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Value> uniqued(payloadValues.begin(), payloadValues.end());
+ SetVector<Value> uniqued(llvm::from_range, payloadValues);
results.setValues(cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 68f8387957ba1..d50c26a0fd92e 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2747,8 +2747,7 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
void mlir::reconcileUnrealizedCasts(
ArrayRef<UnrealizedConversionCastOp> castOps,
SmallVectorImpl<UnrealizedConversionCastOp> *remainingCastOps) {
- SetVector<UnrealizedConversionCastOp> worklist(castOps.begin(),
- castOps.end());
+ SetVector<UnrealizedConversionCastOp> worklist(llvm::from_range, castOps);
// This set is maintained only if `remainingCastOps` is provided.
DenseSet<Operation *> erasedOps;
|
@llvm/pr-subscribers-mlir-cf Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/137563.diff 9 Files Affected:
diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index e5f4ab57a9d88..5aebb19e3a86e 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -197,8 +197,7 @@ static bool dependsOnCarriedVals(Value value,
// Check that none of the operands of the operations in the backward slice are
// loop iteration arguments, and neither is the value itself.
- SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
- iterCarriedArgs.end());
+ SmallPtrSet<Value, 8> iterCarriedValSet(llvm::from_range, iterCarriedArgs);
if (iterCarriedValSet.contains(value))
return true;
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index 402be0f29e5c7..9b36bd964ef10 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -304,8 +304,8 @@ outlineExecuteOp(SymbolTable &symbolTable, ExecuteOp execute) {
cloneConstantsIntoTheRegion(execute.getBodyRegion());
// Collect all outlined function inputs.
- SetVector<mlir::Value> functionInputs(execute.getDependencies().begin(),
- execute.getDependencies().end());
+ SetVector<mlir::Value> functionInputs(llvm::from_range,
+ execute.getDependencies());
functionInputs.insert_range(execute.getBodyOperands());
getUsedValuesDefinedAbove(execute.getBodyRegion(), functionInputs);
diff --git a/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp b/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
index 89546da428fa2..a077f56f4f472 100644
--- a/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
@@ -133,8 +133,8 @@ struct CondBranchOpInterface
// We specifically need to update the ownerships of values that are retained
// in both dealloc operations again to get a combined 'Unique' ownership
// instead of an 'Unknown' ownership.
- SmallPtrSet<Value, 16> thenValues(thenTakenDeallocOp.getRetained().begin(),
- thenTakenDeallocOp.getRetained().end());
+ SmallPtrSet<Value, 16> thenValues(llvm::from_range,
+ thenTakenDeallocOp.getRetained());
SetVector<Value> commonValues;
for (Value val : elseTakenDeallocOp.getRetained()) {
if (thenValues.contains(val))
diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index 62dc1f13412d4..a64ec8d52daf0 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -267,7 +267,7 @@ gpu::GPUFuncOp mlir::outlineKernelFunc(gpu::LaunchOp launchOp,
llvm::SmallVectorImpl<Value> &operands) {
DenseSet<Value> inputOperandSet;
inputOperandSet.insert_range(operands);
- SetVector<Value> operandSet(operands.begin(), operands.end());
+ SetVector<Value> operandSet(llvm::from_range, operands);
auto funcOp = outlineKernelFuncImpl(launchOp, kernelFnName, operandSet);
for (auto operand : operandSet) {
if (!inputOperandSet.count(operand))
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index b20e6050fb4f8..a9b5c2a0f3c18 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -985,8 +985,7 @@ transform::FuseIntoContainingOp::apply(transform::TransformRewriter &rewriter,
// Helper function to find the next producer that should be fused. Take any
// producer that has a use inside the containing op.
- SetVector<Operation *> remainingProducers(producerOps.begin(),
- producerOps.end());
+ SetVector<Operation *> remainingProducers(llvm::from_range, producerOps);
auto getNextProducer = [&]() -> FailureOr<Operation *> {
for (const auto &it : enumerate(remainingProducers)) {
Operation *producerOp = it.value();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp b/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
index 0ddf03bf317e7..f2a64f5bf38a3 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
@@ -766,13 +766,12 @@ bubbleUpPackOpThroughExpandShape(tensor::ExpandShapeOp expandOp,
SmallVector<ReassociationIndices, 4> reassoc =
expandOp.getReassociationIndices();
ArrayRef<int64_t> packInnerDims = packOp.getInnerDimsPos();
- llvm::SetVector<int64_t> packDimsPos(packInnerDims.begin(),
- packInnerDims.end());
+ llvm::SetVector<int64_t> packDimsPos(llvm::from_range, packInnerDims);
for (auto [idx, indices] : llvm::enumerate(reassoc)) {
// For each expand_shape reassociation, figure out which dimensions get
// packed if any.
- llvm::SetVector<int64_t> expandDimPos(indices.begin(), indices.end());
+ llvm::SetVector<int64_t> expandDimPos(llvm::from_range, indices);
llvm::SetVector<int64_t> packedDims =
llvm::set_intersection(packDimsPos, expandDimPos);
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
index d564b4cc8af67..161c885b808b1 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
@@ -94,7 +94,7 @@ SmallVector<spirv::Capability, 0>
spirv::getRecursiveImpliedCapabilities(spirv::Capability cap) {
ArrayRef<spirv::Capability> directCaps = getDirectImpliedCapabilities(cap);
SetVector<spirv::Capability, SmallVector<spirv::Capability, 0>> allCaps(
- directCaps.begin(), directCaps.end());
+ llvm::from_range, directCaps);
// TODO: This is insufficient; find a better way to handle this
// (e.g., using static lists) if this turns out to be a bottleneck.
diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index 84d339a985c38..673743f22249a 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -2073,7 +2073,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Operation *> uniqued(operations.begin(), operations.end());
+ SetVector<Operation *> uniqued(llvm::from_range, operations);
results.set(llvm::cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
@@ -2087,7 +2087,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Attribute> uniqued(attrs.begin(), attrs.end());
+ SetVector<Attribute> uniqued(llvm::from_range, attrs);
results.setParams(cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
@@ -2103,7 +2103,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Value> uniqued(payloadValues.begin(), payloadValues.end());
+ SetVector<Value> uniqued(llvm::from_range, payloadValues);
results.setValues(cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 68f8387957ba1..d50c26a0fd92e 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2747,8 +2747,7 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
void mlir::reconcileUnrealizedCasts(
ArrayRef<UnrealizedConversionCastOp> castOps,
SmallVectorImpl<UnrealizedConversionCastOp> *remainingCastOps) {
- SetVector<UnrealizedConversionCastOp> worklist(castOps.begin(),
- castOps.end());
+ SetVector<UnrealizedConversionCastOp> worklist(llvm::from_range, castOps);
// This set is maintained only if `remainingCastOps` is provided.
DenseSet<Operation *> erasedOps;
|
@llvm/pr-subscribers-mlir Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/137563.diff 9 Files Affected:
diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index e5f4ab57a9d88..5aebb19e3a86e 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -197,8 +197,7 @@ static bool dependsOnCarriedVals(Value value,
// Check that none of the operands of the operations in the backward slice are
// loop iteration arguments, and neither is the value itself.
- SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
- iterCarriedArgs.end());
+ SmallPtrSet<Value, 8> iterCarriedValSet(llvm::from_range, iterCarriedArgs);
if (iterCarriedValSet.contains(value))
return true;
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index 402be0f29e5c7..9b36bd964ef10 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -304,8 +304,8 @@ outlineExecuteOp(SymbolTable &symbolTable, ExecuteOp execute) {
cloneConstantsIntoTheRegion(execute.getBodyRegion());
// Collect all outlined function inputs.
- SetVector<mlir::Value> functionInputs(execute.getDependencies().begin(),
- execute.getDependencies().end());
+ SetVector<mlir::Value> functionInputs(llvm::from_range,
+ execute.getDependencies());
functionInputs.insert_range(execute.getBodyOperands());
getUsedValuesDefinedAbove(execute.getBodyRegion(), functionInputs);
diff --git a/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp b/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
index 89546da428fa2..a077f56f4f472 100644
--- a/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
@@ -133,8 +133,8 @@ struct CondBranchOpInterface
// We specifically need to update the ownerships of values that are retained
// in both dealloc operations again to get a combined 'Unique' ownership
// instead of an 'Unknown' ownership.
- SmallPtrSet<Value, 16> thenValues(thenTakenDeallocOp.getRetained().begin(),
- thenTakenDeallocOp.getRetained().end());
+ SmallPtrSet<Value, 16> thenValues(llvm::from_range,
+ thenTakenDeallocOp.getRetained());
SetVector<Value> commonValues;
for (Value val : elseTakenDeallocOp.getRetained()) {
if (thenValues.contains(val))
diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index 62dc1f13412d4..a64ec8d52daf0 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -267,7 +267,7 @@ gpu::GPUFuncOp mlir::outlineKernelFunc(gpu::LaunchOp launchOp,
llvm::SmallVectorImpl<Value> &operands) {
DenseSet<Value> inputOperandSet;
inputOperandSet.insert_range(operands);
- SetVector<Value> operandSet(operands.begin(), operands.end());
+ SetVector<Value> operandSet(llvm::from_range, operands);
auto funcOp = outlineKernelFuncImpl(launchOp, kernelFnName, operandSet);
for (auto operand : operandSet) {
if (!inputOperandSet.count(operand))
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index b20e6050fb4f8..a9b5c2a0f3c18 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -985,8 +985,7 @@ transform::FuseIntoContainingOp::apply(transform::TransformRewriter &rewriter,
// Helper function to find the next producer that should be fused. Take any
// producer that has a use inside the containing op.
- SetVector<Operation *> remainingProducers(producerOps.begin(),
- producerOps.end());
+ SetVector<Operation *> remainingProducers(llvm::from_range, producerOps);
auto getNextProducer = [&]() -> FailureOr<Operation *> {
for (const auto &it : enumerate(remainingProducers)) {
Operation *producerOp = it.value();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp b/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
index 0ddf03bf317e7..f2a64f5bf38a3 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
@@ -766,13 +766,12 @@ bubbleUpPackOpThroughExpandShape(tensor::ExpandShapeOp expandOp,
SmallVector<ReassociationIndices, 4> reassoc =
expandOp.getReassociationIndices();
ArrayRef<int64_t> packInnerDims = packOp.getInnerDimsPos();
- llvm::SetVector<int64_t> packDimsPos(packInnerDims.begin(),
- packInnerDims.end());
+ llvm::SetVector<int64_t> packDimsPos(llvm::from_range, packInnerDims);
for (auto [idx, indices] : llvm::enumerate(reassoc)) {
// For each expand_shape reassociation, figure out which dimensions get
// packed if any.
- llvm::SetVector<int64_t> expandDimPos(indices.begin(), indices.end());
+ llvm::SetVector<int64_t> expandDimPos(llvm::from_range, indices);
llvm::SetVector<int64_t> packedDims =
llvm::set_intersection(packDimsPos, expandDimPos);
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
index d564b4cc8af67..161c885b808b1 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
@@ -94,7 +94,7 @@ SmallVector<spirv::Capability, 0>
spirv::getRecursiveImpliedCapabilities(spirv::Capability cap) {
ArrayRef<spirv::Capability> directCaps = getDirectImpliedCapabilities(cap);
SetVector<spirv::Capability, SmallVector<spirv::Capability, 0>> allCaps(
- directCaps.begin(), directCaps.end());
+ llvm::from_range, directCaps);
// TODO: This is insufficient; find a better way to handle this
// (e.g., using static lists) if this turns out to be a bottleneck.
diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index 84d339a985c38..673743f22249a 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -2073,7 +2073,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Operation *> uniqued(operations.begin(), operations.end());
+ SetVector<Operation *> uniqued(llvm::from_range, operations);
results.set(llvm::cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
@@ -2087,7 +2087,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Attribute> uniqued(attrs.begin(), attrs.end());
+ SetVector<Attribute> uniqued(llvm::from_range, attrs);
results.setParams(cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
@@ -2103,7 +2103,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Value> uniqued(payloadValues.begin(), payloadValues.end());
+ SetVector<Value> uniqued(llvm::from_range, payloadValues);
results.setValues(cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 68f8387957ba1..d50c26a0fd92e 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2747,8 +2747,7 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
void mlir::reconcileUnrealizedCasts(
ArrayRef<UnrealizedConversionCastOp> castOps,
SmallVectorImpl<UnrealizedConversionCastOp> *remainingCastOps) {
- SetVector<UnrealizedConversionCastOp> worklist(castOps.begin(),
- castOps.end());
+ SetVector<UnrealizedConversionCastOp> worklist(llvm::from_range, castOps);
// This set is maintained only if `remainingCastOps` is provided.
DenseSet<Operation *> erasedOps;
|
@llvm/pr-subscribers-mlir-spirv Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/137563.diff 9 Files Affected:
diff --git a/mlir/lib/Analysis/SliceAnalysis.cpp b/mlir/lib/Analysis/SliceAnalysis.cpp
index e5f4ab57a9d88..5aebb19e3a86e 100644
--- a/mlir/lib/Analysis/SliceAnalysis.cpp
+++ b/mlir/lib/Analysis/SliceAnalysis.cpp
@@ -197,8 +197,7 @@ static bool dependsOnCarriedVals(Value value,
// Check that none of the operands of the operations in the backward slice are
// loop iteration arguments, and neither is the value itself.
- SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
- iterCarriedArgs.end());
+ SmallPtrSet<Value, 8> iterCarriedValSet(llvm::from_range, iterCarriedArgs);
if (iterCarriedValSet.contains(value))
return true;
diff --git a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
index 402be0f29e5c7..9b36bd964ef10 100644
--- a/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
+++ b/mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp
@@ -304,8 +304,8 @@ outlineExecuteOp(SymbolTable &symbolTable, ExecuteOp execute) {
cloneConstantsIntoTheRegion(execute.getBodyRegion());
// Collect all outlined function inputs.
- SetVector<mlir::Value> functionInputs(execute.getDependencies().begin(),
- execute.getDependencies().end());
+ SetVector<mlir::Value> functionInputs(llvm::from_range,
+ execute.getDependencies());
functionInputs.insert_range(execute.getBodyOperands());
getUsedValuesDefinedAbove(execute.getBodyRegion(), functionInputs);
diff --git a/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp b/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
index 89546da428fa2..a077f56f4f472 100644
--- a/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp
@@ -133,8 +133,8 @@ struct CondBranchOpInterface
// We specifically need to update the ownerships of values that are retained
// in both dealloc operations again to get a combined 'Unique' ownership
// instead of an 'Unknown' ownership.
- SmallPtrSet<Value, 16> thenValues(thenTakenDeallocOp.getRetained().begin(),
- thenTakenDeallocOp.getRetained().end());
+ SmallPtrSet<Value, 16> thenValues(llvm::from_range,
+ thenTakenDeallocOp.getRetained());
SetVector<Value> commonValues;
for (Value val : elseTakenDeallocOp.getRetained()) {
if (thenValues.contains(val))
diff --git a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
index 62dc1f13412d4..a64ec8d52daf0 100644
--- a/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
+++ b/mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp
@@ -267,7 +267,7 @@ gpu::GPUFuncOp mlir::outlineKernelFunc(gpu::LaunchOp launchOp,
llvm::SmallVectorImpl<Value> &operands) {
DenseSet<Value> inputOperandSet;
inputOperandSet.insert_range(operands);
- SetVector<Value> operandSet(operands.begin(), operands.end());
+ SetVector<Value> operandSet(llvm::from_range, operands);
auto funcOp = outlineKernelFuncImpl(launchOp, kernelFnName, operandSet);
for (auto operand : operandSet) {
if (!inputOperandSet.count(operand))
diff --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index b20e6050fb4f8..a9b5c2a0f3c18 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -985,8 +985,7 @@ transform::FuseIntoContainingOp::apply(transform::TransformRewriter &rewriter,
// Helper function to find the next producer that should be fused. Take any
// producer that has a use inside the containing op.
- SetVector<Operation *> remainingProducers(producerOps.begin(),
- producerOps.end());
+ SetVector<Operation *> remainingProducers(llvm::from_range, producerOps);
auto getNextProducer = [&]() -> FailureOr<Operation *> {
for (const auto &it : enumerate(remainingProducers)) {
Operation *producerOp = it.value();
diff --git a/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp b/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
index 0ddf03bf317e7..f2a64f5bf38a3 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
@@ -766,13 +766,12 @@ bubbleUpPackOpThroughExpandShape(tensor::ExpandShapeOp expandOp,
SmallVector<ReassociationIndices, 4> reassoc =
expandOp.getReassociationIndices();
ArrayRef<int64_t> packInnerDims = packOp.getInnerDimsPos();
- llvm::SetVector<int64_t> packDimsPos(packInnerDims.begin(),
- packInnerDims.end());
+ llvm::SetVector<int64_t> packDimsPos(llvm::from_range, packInnerDims);
for (auto [idx, indices] : llvm::enumerate(reassoc)) {
// For each expand_shape reassociation, figure out which dimensions get
// packed if any.
- llvm::SetVector<int64_t> expandDimPos(indices.begin(), indices.end());
+ llvm::SetVector<int64_t> expandDimPos(llvm::from_range, indices);
llvm::SetVector<int64_t> packedDims =
llvm::set_intersection(packDimsPos, expandDimPos);
diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
index d564b4cc8af67..161c885b808b1 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp
@@ -94,7 +94,7 @@ SmallVector<spirv::Capability, 0>
spirv::getRecursiveImpliedCapabilities(spirv::Capability cap) {
ArrayRef<spirv::Capability> directCaps = getDirectImpliedCapabilities(cap);
SetVector<spirv::Capability, SmallVector<spirv::Capability, 0>> allCaps(
- directCaps.begin(), directCaps.end());
+ llvm::from_range, directCaps);
// TODO: This is insufficient; find a better way to handle this
// (e.g., using static lists) if this turns out to be a bottleneck.
diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
index 84d339a985c38..673743f22249a 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp
@@ -2073,7 +2073,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Operation *> uniqued(operations.begin(), operations.end());
+ SetVector<Operation *> uniqued(llvm::from_range, operations);
results.set(llvm::cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
@@ -2087,7 +2087,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Attribute> uniqued(attrs.begin(), attrs.end());
+ SetVector<Attribute> uniqued(llvm::from_range, attrs);
results.setParams(cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
@@ -2103,7 +2103,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
return DiagnosedSilenceableFailure::success();
}
- SetVector<Value> uniqued(payloadValues.begin(), payloadValues.end());
+ SetVector<Value> uniqued(llvm::from_range, payloadValues);
results.setValues(cast<OpResult>(getResult()), uniqued.getArrayRef());
return DiagnosedSilenceableFailure::success();
}
diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp
index 68f8387957ba1..d50c26a0fd92e 100644
--- a/mlir/lib/Transforms/Utils/DialectConversion.cpp
+++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp
@@ -2747,8 +2747,7 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
void mlir::reconcileUnrealizedCasts(
ArrayRef<UnrealizedConversionCastOp> castOps,
SmallVectorImpl<UnrealizedConversionCastOp> *remainingCastOps) {
- SetVector<UnrealizedConversionCastOp> worklist(castOps.begin(),
- castOps.end());
+ SetVector<UnrealizedConversionCastOp> worklist(llvm::from_range, castOps);
// This set is maintained only if `remainingCastOps` is provided.
DenseSet<Operation *> erasedOps;
|
No description provided.