Skip to content

Commit 5e834b9

Browse files
[mlir] Call hash_combine_range with ranges (NFC) (#136512)
1 parent b01e25d commit 5e834b9

File tree

8 files changed

+17
-22
lines changed

8 files changed

+17
-22
lines changed

mlir/include/mlir/Dialect/Polynomial/IR/Polynomial.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class FloatPolynomial : public PolynomialBase<FloatPolynomial, FloatMonomial> {
260260
// Make Polynomials hashable.
261261
template <class D, typename T>
262262
inline ::llvm::hash_code hash_value(const PolynomialBase<D, T> &arg) {
263-
return ::llvm::hash_combine_range(arg.terms.begin(), arg.terms.end());
263+
return ::llvm::hash_combine_range(arg.terms);
264264
}
265265

266266
template <class D, typename T>

mlir/include/mlir/IR/BlockSupport.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ struct DenseMapInfo<mlir::SuccessorRange> {
185185
return mlir::SuccessorRange(pointer, 0);
186186
}
187187
static unsigned getHashValue(mlir::SuccessorRange value) {
188-
return llvm::hash_combine_range(value.begin(), value.end());
188+
return llvm::hash_combine_range(value);
189189
}
190190
static bool isEqual(mlir::SuccessorRange lhs, mlir::SuccessorRange rhs) {
191191
if (rhs.getBase() == getEmptyKey().getBase())

mlir/include/mlir/IR/TypeRange.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class TypeRange : public llvm::detail::indexed_accessor_range_base<
7272

7373
/// Make TypeRange hashable.
7474
inline ::llvm::hash_code hash_value(TypeRange arg) {
75-
return ::llvm::hash_combine_range(arg.begin(), arg.end());
75+
return ::llvm::hash_combine_range(arg);
7676
}
7777

7878
/// Emit a type range to the given output stream.

mlir/lib/Dialect/Quant/IR/TypeDetail.h

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -207,11 +207,10 @@ struct UniformQuantizedPerAxisTypeStorage : public QuantizedTypeStorage {
207207
unsigned getHashValue() const {
208208
int64_t *scalesCast = llvm::bit_cast<int64_t *>(scales.data());
209209
ArrayRef<int64_t> scalesBits(scalesCast, scales.size());
210-
return llvm::hash_combine(
211-
flags, storageType, expressedType,
212-
llvm::hash_combine_range(scalesBits.begin(), scalesBits.end()),
213-
llvm::hash_combine_range(zeroPoints.begin(), zeroPoints.end()),
214-
storageTypeMin, storageTypeMax);
210+
return llvm::hash_combine(flags, storageType, expressedType,
211+
llvm::hash_combine_range(scalesBits),
212+
llvm::hash_combine_range(zeroPoints),
213+
storageTypeMin, storageTypeMax);
215214
}
216215
};
217216

@@ -318,11 +317,9 @@ struct UniformQuantizedSubChannelTypeStorage : public QuantizedTypeStorage {
318317
}
319318

320319
// Hash the quantized dimensions and block sizes.
321-
hash = llvm::hash_combine(
322-
hash,
323-
llvm::hash_combine_range(quantizedDimensions.begin(),
324-
quantizedDimensions.end()),
325-
llvm::hash_combine_range(blockSizes.begin(), blockSizes.end()));
320+
hash = llvm::hash_combine(hash,
321+
llvm::hash_combine_range(quantizedDimensions),
322+
llvm::hash_combine_range(blockSizes));
326323

327324
return hash;
328325
}

mlir/lib/Dialect/SPIRV/Linking/ModuleCombiner/ModuleCombiner.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,8 @@ static llvm::hash_code computeHash(SymbolOpInterface symbolOp) {
7979
return attr.getName() != SymbolTable::getSymbolAttrName();
8080
});
8181

82-
return llvm::hash_combine(
83-
symbolOp->getName(),
84-
llvm::hash_combine_range(range.begin(), range.end()));
82+
return llvm::hash_combine(symbolOp->getName(),
83+
llvm::hash_combine_range(range));
8584
}
8685

8786
namespace mlir {

mlir/lib/Dialect/Vector/Transforms/VectorUnroll.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ struct OffsetMapInfo {
238238
static SmallVector<int64_t> getTombstoneKey() { return {int64_t(-2)}; }
239239

240240
static unsigned getHashValue(const SmallVector<int64_t> &v) {
241-
return static_cast<unsigned>(llvm::hash_combine_range(v.begin(), v.end()));
241+
return static_cast<unsigned>(llvm::hash_combine_range(v));
242242
}
243243

244244
static bool isEqual(const SmallVector<int64_t> &lhs,

mlir/lib/Transforms/Utils/DialectConversion.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ struct ValueVectorMapInfo {
106106
static ValueVector getEmptyKey() { return ValueVector{Value()}; }
107107
static ValueVector getTombstoneKey() { return ValueVector{Value(), Value()}; }
108108
static ::llvm::hash_code getHashValue(const ValueVector &val) {
109-
return ::llvm::hash_combine_range(val.begin(), val.end());
109+
return ::llvm::hash_combine_range(val);
110110
}
111111
static bool isEqual(const ValueVector &LHS, const ValueVector &RHS) {
112112
return LHS == RHS;

mlir/unittests/IR/OpPropertiesTest.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ inline llvm::hash_code computeHash(const TestProperties &prop) {
9696
// We hash `b` which is a float using its underlying array of char:
9797
unsigned char const *p = reinterpret_cast<unsigned char const *>(&prop.b);
9898
ArrayRef<unsigned char> bBytes{p, sizeof(prop.b)};
99-
return llvm::hash_combine(
100-
prop.a, llvm::hash_combine_range(bBytes.begin(), bBytes.end()),
101-
llvm::hash_combine_range(prop.array.begin(), prop.array.end()),
102-
StringRef(*prop.label));
99+
return llvm::hash_combine(prop.a, llvm::hash_combine_range(bBytes),
100+
llvm::hash_combine_range(prop.array),
101+
StringRef(*prop.label));
103102
}
104103

105104
/// A custom operation for the purpose of showcasing how to use "properties".

0 commit comments

Comments
 (0)