Skip to content

Commit d1e85a0

Browse files
[mlir] Use range constructors of *Set (NFC) (llvm#137563)
1 parent e13b79c commit d1e85a0

File tree

9 files changed

+14
-18
lines changed

9 files changed

+14
-18
lines changed

mlir/lib/Analysis/SliceAnalysis.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ static bool dependsOnCarriedVals(Value value,
197197

198198
// Check that none of the operands of the operations in the backward slice are
199199
// loop iteration arguments, and neither is the value itself.
200-
SmallPtrSet<Value, 8> iterCarriedValSet(iterCarriedArgs.begin(),
201-
iterCarriedArgs.end());
200+
SmallPtrSet<Value, 8> iterCarriedValSet(llvm::from_range, iterCarriedArgs);
202201
if (iterCarriedValSet.contains(value))
203202
return true;
204203

mlir/lib/Dialect/Async/Transforms/AsyncToAsyncRuntime.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,8 +304,8 @@ outlineExecuteOp(SymbolTable &symbolTable, ExecuteOp execute) {
304304
cloneConstantsIntoTheRegion(execute.getBodyRegion());
305305

306306
// Collect all outlined function inputs.
307-
SetVector<mlir::Value> functionInputs(execute.getDependencies().begin(),
308-
execute.getDependencies().end());
307+
SetVector<mlir::Value> functionInputs(llvm::from_range,
308+
execute.getDependencies());
309309
functionInputs.insert_range(execute.getBodyOperands());
310310
getUsedValuesDefinedAbove(execute.getBodyRegion(), functionInputs);
311311

mlir/lib/Dialect/ControlFlow/Transforms/BufferDeallocationOpInterfaceImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ struct CondBranchOpInterface
133133
// We specifically need to update the ownerships of values that are retained
134134
// in both dealloc operations again to get a combined 'Unique' ownership
135135
// instead of an 'Unknown' ownership.
136-
SmallPtrSet<Value, 16> thenValues(thenTakenDeallocOp.getRetained().begin(),
137-
thenTakenDeallocOp.getRetained().end());
136+
SmallPtrSet<Value, 16> thenValues(llvm::from_range,
137+
thenTakenDeallocOp.getRetained());
138138
SetVector<Value> commonValues;
139139
for (Value val : elseTakenDeallocOp.getRetained()) {
140140
if (thenValues.contains(val))

mlir/lib/Dialect/GPU/Transforms/KernelOutlining.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ gpu::GPUFuncOp mlir::outlineKernelFunc(gpu::LaunchOp launchOp,
267267
llvm::SmallVectorImpl<Value> &operands) {
268268
DenseSet<Value> inputOperandSet;
269269
inputOperandSet.insert_range(operands);
270-
SetVector<Value> operandSet(operands.begin(), operands.end());
270+
SetVector<Value> operandSet(llvm::from_range, operands);
271271
auto funcOp = outlineKernelFuncImpl(launchOp, kernelFnName, operandSet);
272272
for (auto operand : operandSet) {
273273
if (!inputOperandSet.count(operand))

mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,8 +985,7 @@ transform::FuseIntoContainingOp::apply(transform::TransformRewriter &rewriter,
985985

986986
// Helper function to find the next producer that should be fused. Take any
987987
// producer that has a use inside the containing op.
988-
SetVector<Operation *> remainingProducers(producerOps.begin(),
989-
producerOps.end());
988+
SetVector<Operation *> remainingProducers(llvm::from_range, producerOps);
990989
auto getNextProducer = [&]() -> FailureOr<Operation *> {
991990
for (const auto &it : enumerate(remainingProducers)) {
992991
Operation *producerOp = it.value();

mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,13 +766,12 @@ bubbleUpPackOpThroughExpandShape(tensor::ExpandShapeOp expandOp,
766766
SmallVector<ReassociationIndices, 4> reassoc =
767767
expandOp.getReassociationIndices();
768768
ArrayRef<int64_t> packInnerDims = packOp.getInnerDimsPos();
769-
llvm::SetVector<int64_t> packDimsPos(packInnerDims.begin(),
770-
packInnerDims.end());
769+
llvm::SetVector<int64_t> packDimsPos(llvm::from_range, packInnerDims);
771770

772771
for (auto [idx, indices] : llvm::enumerate(reassoc)) {
773772
// For each expand_shape reassociation, figure out which dimensions get
774773
// packed if any.
775-
llvm::SetVector<int64_t> expandDimPos(indices.begin(), indices.end());
774+
llvm::SetVector<int64_t> expandDimPos(llvm::from_range, indices);
776775
llvm::SetVector<int64_t> packedDims =
777776
llvm::set_intersection(packDimsPos, expandDimPos);
778777

mlir/lib/Dialect/SPIRV/IR/SPIRVEnums.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ SmallVector<spirv::Capability, 0>
9494
spirv::getRecursiveImpliedCapabilities(spirv::Capability cap) {
9595
ArrayRef<spirv::Capability> directCaps = getDirectImpliedCapabilities(cap);
9696
SetVector<spirv::Capability, SmallVector<spirv::Capability, 0>> allCaps(
97-
directCaps.begin(), directCaps.end());
97+
llvm::from_range, directCaps);
9898

9999
// TODO: This is insufficient; find a better way to handle this
100100
// (e.g., using static lists) if this turns out to be a bottleneck.

mlir/lib/Dialect/Transform/IR/TransformOps.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
20732073
return DiagnosedSilenceableFailure::success();
20742074
}
20752075

2076-
SetVector<Operation *> uniqued(operations.begin(), operations.end());
2076+
SetVector<Operation *> uniqued(llvm::from_range, operations);
20772077
results.set(llvm::cast<OpResult>(getResult()), uniqued.getArrayRef());
20782078
return DiagnosedSilenceableFailure::success();
20792079
}
@@ -2087,7 +2087,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
20872087
return DiagnosedSilenceableFailure::success();
20882088
}
20892089

2090-
SetVector<Attribute> uniqued(attrs.begin(), attrs.end());
2090+
SetVector<Attribute> uniqued(llvm::from_range, attrs);
20912091
results.setParams(cast<OpResult>(getResult()), uniqued.getArrayRef());
20922092
return DiagnosedSilenceableFailure::success();
20932093
}
@@ -2103,7 +2103,7 @@ transform::MergeHandlesOp::apply(transform::TransformRewriter &rewriter,
21032103
return DiagnosedSilenceableFailure::success();
21042104
}
21052105

2106-
SetVector<Value> uniqued(payloadValues.begin(), payloadValues.end());
2106+
SetVector<Value> uniqued(llvm::from_range, payloadValues);
21072107
results.setValues(cast<OpResult>(getResult()), uniqued.getArrayRef());
21082108
return DiagnosedSilenceableFailure::success();
21092109
}

mlir/lib/Transforms/Utils/DialectConversion.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2747,8 +2747,7 @@ LogicalResult OperationConverter::convertOperations(ArrayRef<Operation *> ops) {
27472747
void mlir::reconcileUnrealizedCasts(
27482748
ArrayRef<UnrealizedConversionCastOp> castOps,
27492749
SmallVectorImpl<UnrealizedConversionCastOp> *remainingCastOps) {
2750-
SetVector<UnrealizedConversionCastOp> worklist(castOps.begin(),
2751-
castOps.end());
2750+
SetVector<UnrealizedConversionCastOp> worklist(llvm::from_range, castOps);
27522751
// This set is maintained only if `remainingCastOps` is provided.
27532752
DenseSet<Operation *> erasedOps;
27542753

0 commit comments

Comments
 (0)