-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[llvm] Call hash_combine_range with ranges (NFC) #136511
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
[llvm] Call hash_combine_range with ranges (NFC) #136511
Conversation
|
@llvm/pr-subscribers-vectorizers @llvm/pr-subscribers-llvm-adt Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136511.diff 23 Files Affected:
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index 1139fd81cbd07..a1317423cdd1a 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -562,7 +562,7 @@ namespace llvm {
/// @}
template <typename T> hash_code hash_value(ArrayRef<T> S) {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
// Provide DenseMapInfo for ArrayRefs.
diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 9b8643b7765cf..0093c281aac8a 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -649,7 +649,7 @@ template <typename... Ts> hash_code hash_value(const std::tuple<Ts...> &arg) {
// infrastructure is available.
template <typename T>
hash_code hash_value(const std::basic_string<T> &arg) {
- return hash_combine_range(arg.begin(), arg.end());
+ return hash_combine_range(arg);
}
template <typename T> hash_code hash_value(const std::optional<T> &arg) {
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index 9da465ddf75f9..eb1827850567d 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -263,37 +263,35 @@ struct IRInstructionData
OperTypes.push_back(V->getType());
if (isa<CmpInst>(ID.Inst))
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.getPredicate()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.getPredicate()),
+ llvm::hash_combine_range(OperTypes));
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(ID.Inst)) {
// To hash intrinsics, we use the opcode, and types like the other
// instructions, but also, the Intrinsic ID, and the Name of the
// intrinsic.
Intrinsic::ID IntrinsicID = II->getIntrinsicID();
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(IntrinsicID),
- llvm::hash_value(*ID.CalleeName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(IntrinsicID),
+ llvm::hash_value(*ID.CalleeName),
+ llvm::hash_combine_range(OperTypes));
}
if (isa<CallInst>(ID.Inst)) {
std::string FunctionName = *ID.CalleeName;
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(FunctionName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(FunctionName),
+ llvm::hash_combine_range(OperTypes));
}
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_combine_range(OperTypes));
}
IRInstructionDataList *IDL = nullptr;
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index e7b154dff0697..66fe0da21deb7 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -506,7 +506,7 @@ using SampleContextFrames = ArrayRef<SampleContextFrame>;
struct SampleContextFrameHash {
uint64_t operator()(const SampleContextFrameVector &S) const {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
};
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
index e4972cb1cef84..d15a3d777ab0e 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
@@ -119,8 +119,7 @@ struct SpecSig {
}
friend hash_code hash_value(const SpecSig &S) {
- return hash_combine(hash_value(S.Key),
- hash_combine_range(S.Args.begin(), S.Args.end()));
+ return hash_combine(hash_value(S.Key), hash_combine_range(S.Args));
}
};
diff --git a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
index b888b81e92b92..a22cc91b90542 100644
--- a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
+++ b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
@@ -131,7 +131,7 @@ std::string VRegRenamer::getInstructionOpcodeHash(MachineInstr &MI) {
MIOperands.push_back((unsigned)Op->getFailureOrdering());
}
- auto HashMI = hash_combine_range(MIOperands.begin(), MIOperands.end());
+ auto HashMI = hash_combine_range(MIOperands);
OS << format_hex_no_prefix(HashMI, 16, true);
return OS.str();
}
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 33910d0ec6aeb..2bc18001081ea 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -2306,7 +2306,7 @@ MachineInstrExpressionTrait::getHashValue(const MachineInstr* const &MI) {
HashComponents.push_back(hash_value(MO));
}
- return hash_combine_range(HashComponents.begin(), HashComponents.end());
+ return hash_combine_range(HashComponents);
}
const MDNode *MachineInstr::getLocCookieMD() const {
diff --git a/llvm/lib/CodeGen/RegisterBankInfo.cpp b/llvm/lib/CodeGen/RegisterBankInfo.cpp
index eaef13969a7a1..79b3c73ea34f1 100644
--- a/llvm/lib/CodeGen/RegisterBankInfo.cpp
+++ b/llvm/lib/CodeGen/RegisterBankInfo.cpp
@@ -307,7 +307,7 @@ hashValueMapping(const RegisterBankInfo::PartialMapping *BreakDown,
SmallVector<size_t, 8> Hashes(NumBreakDowns);
for (unsigned Idx = 0; Idx != NumBreakDowns; ++Idx)
Hashes.push_back(hash_value(BreakDown[Idx]));
- return hash_combine_range(Hashes.begin(), Hashes.end());
+ return hash_combine_range(Hashes);
}
const RegisterBankInfo::ValueMapping &
diff --git a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
index 1a37469c35d2e..7a105c3a7137a 100644
--- a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
@@ -268,7 +268,7 @@ void IRPartitionLayer::emitPartition(
for (const auto *GV : HashGVs) {
assert(GV->hasName() && "All GVs to extract should be named by now");
auto GVName = GV->getName();
- HC = hash_combine(HC, hash_combine_range(GVName.begin(), GVName.end()));
+ HC = hash_combine(HC, hash_combine_range(GVName));
}
raw_string_ostream(SubModuleName)
<< ".submodule."
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index e5c9622e09927..51fb40bad201d 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -322,9 +322,7 @@ template <class ConstantClass> struct ConstantAggrKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantClass>::TypeClass;
@@ -478,10 +476,8 @@ struct ConstantExprKeyType {
}
unsigned getHash() const {
- return hash_combine(
- Opcode, SubclassOptionalData,
- hash_combine_range(Ops.begin(), Ops.end()),
- hash_combine_range(ShuffleMask.begin(), ShuffleMask.end()), ExplicitTy);
+ return hash_combine(Opcode, SubclassOptionalData, hash_combine_range(Ops),
+ hash_combine_range(ShuffleMask), ExplicitTy);
}
using TypeClass = ConstantInfo<ConstantExpr>::TypeClass;
@@ -537,9 +533,7 @@ struct ConstantPtrAuthKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantPtrAuth>::TypeClass;
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 5e51b3ca4e87d..d8cdbf8370984 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -207,7 +207,7 @@ unsigned MDNodeOpsKey::calculateHash(MDNode *N, unsigned Offset) {
}
unsigned MDNodeOpsKey::calculateHash(ArrayRef<Metadata *> Ops) {
- return hash_combine_range(Ops.begin(), Ops.end());
+ return hash_combine_range(Ops);
}
StringMapEntry<uint32_t> *LLVMContextImpl::getOrInsertBundleTag(StringRef Tag) {
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index efabe40fab192..9b60b57e64130 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -119,8 +119,7 @@ struct AnonStructTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()), Key.isPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.isPacked);
}
static unsigned getHashValue(const StructType *ST) {
@@ -171,9 +170,8 @@ struct FunctionTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.ReturnType,
- hash_combine_range(Key.Params.begin(), Key.Params.end()), Key.isVarArg);
+ return hash_combine(Key.ReturnType, hash_combine_range(Key.Params),
+ Key.isVarArg);
}
static unsigned getHashValue(const FunctionType *FT) {
@@ -219,10 +217,8 @@ struct TargetExtTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.Name,
- hash_combine_range(Key.TypeParams.begin(), Key.TypeParams.end()),
- hash_combine_range(Key.IntParams.begin(), Key.IntParams.end()));
+ return hash_combine(Key.Name, hash_combine_range(Key.TypeParams),
+ hash_combine_range(Key.IntParams));
}
static unsigned getHashValue(const TargetExtType *FT) {
@@ -1324,9 +1320,7 @@ template <> struct MDNodeKeyImpl<DIExpression> {
return Elements == RHS->getElements();
}
- unsigned getHashValue() const {
- return hash_combine_range(Elements.begin(), Elements.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Elements); }
};
template <> struct MDNodeKeyImpl<DIGlobalVariableExpression> {
@@ -1463,9 +1457,7 @@ struct DIArgListKeyInfo {
bool isKeyOf(const DIArgList *RHS) const { return Args == RHS->getArgs(); }
- unsigned getHashValue() const {
- return hash_combine_range(Args.begin(), Args.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Args); }
};
/// DenseMapInfo for DIArgList.
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index e732367b5127e..0f32e9e1a05a5 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1689,8 +1689,7 @@ StructType *IRMover::StructTypeKeyInfo::getTombstoneKey() {
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const KeyTy &Key) {
- return hash_combine(hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()),
- Key.IsPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.IsPacked);
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const StructType *ST) {
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index 4f5fcb4857e80..96829bd062a78 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -613,9 +613,7 @@ bool StringRef::getAsDouble(double &Result, bool AllowInexact) const {
}
// Implementation of StringRef hashing.
-hash_code llvm::hash_value(StringRef S) {
- return hash_combine_range(S.begin(), S.end());
-}
+hash_code llvm::hash_value(StringRef S) { return hash_combine_range(S); }
unsigned DenseMapInfo<StringRef, void>::getHashValue(StringRef Val) {
assert(Val.data() != getEmptyKey().data() &&
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index eec869d57a6db..6c9d499b0e7ea 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1154,9 +1154,9 @@ using PHINodeData = std::pair<ArgLocWithBBCanon, CanonList>;
/// \param PND - The data to hash.
/// \returns The hash code of \p PND.
static hash_code encodePHINodeData(PHINodeData &PND) {
- return llvm::hash_combine(
- llvm::hash_value(PND.first.first), llvm::hash_value(PND.first.second),
- llvm::hash_combine_range(PND.second.begin(), PND.second.end()));
+ return llvm::hash_combine(llvm::hash_value(PND.first.first),
+ llvm::hash_value(PND.first.second),
+ llvm::hash_combine_range(PND.second));
}
/// Create a special GVN for PHINodes that will be used outside of
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 6233e8e2ee681..c0ae944ee82f2 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -165,9 +165,8 @@ struct llvm::GVNPass::Expression {
}
friend hash_code hash_value(const Expression &Value) {
- return hash_combine(
- Value.Opcode, Value.Ty,
- hash_combine_range(Value.VarArgs.begin(), Value.VarArgs.end()));
+ return hash_combine(Value.Opcode, Value.Ty,
+ hash_combine_range(Value.VarArgs));
}
};
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 6f88408abfdbc..2058df33ea331 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -249,7 +249,7 @@ class ModelledPHI {
// Hash functor
unsigned hash() const {
// Is deterministic because Values are saved in a specific order.
- return (unsigned)hash_combine_range(Values.begin(), Values.end());
+ return (unsigned)hash_combine_range(Values);
}
bool operator==(const ModelledPHI &Other) const {
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index ed3709b74d60f..fd16593b2e874 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1291,7 +1291,7 @@ struct UniquifierDenseMapInfo {
}
static unsigned getHashValue(const SmallVector<const SCEV *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<const SCEV *, 4> &LHS,
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index b07f3451420c7..c5c4968ef4dcc 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -553,8 +553,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
std::pair<std::pair<hash_code, DILocalVariable *>, DIExpression *>;
auto makeHash = [](auto *D) -> DbgIntrinsicHash {
auto VarLocOps = D->location_ops();
- return {{hash_combine_range(VarLocOps.begin(), VarLocOps.end()),
- D->getVariable()},
+ return {{hash_combine_range(VarLocOps), D->getVariable()},
D->getExpression()};
};
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 7f53aa7d4f73d..9e6ee58cafc79 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -7469,8 +7469,7 @@ template <> struct DenseMapInfo<const SwitchSuccWrapper *> {
for (PHINode &Phi : BB->phis())
PhiValsForBB.emplace_back((*SSW->PhiPredIVs)[&Phi][BB]);
- return hash_combine(
- BB, hash_combine_range(PhiValsForBB.begin(), PhiValsForBB.end()));
+ return hash_combine(BB, hash_combine_range(PhiValsForBB));
}
static bool isEqual(const SwitchSuccWrapper *LHS,
const SwitchSuccWrapper *RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 70cd201ab20a6..a56728226c039 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5085,7 +5085,7 @@ class BoUpSLP {
}
static unsigned getHashValue(const OrdersType &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const OrdersType &LHS, const OrdersType &RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.h b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
index 7f123689170ad..2b927b93e24cf 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanSLP.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
@@ -85,7 +85,7 @@ class VPlanSlp {
}
static unsigned getHashValue(const SmallVector<VPValue *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<VPValue *, 4> &LHS,
diff --git a/llvm/tools/llvm-profgen/PerfReader.h b/llvm/tools/llvm-profgen/PerfReader.h
index a3bd7a0a6493e..4b3ac8f569755 100644
--- a/llvm/tools/llvm-profgen/PerfReader.h
+++ b/llvm/tools/llvm-profgen/PerfReader.h
@@ -386,9 +386,7 @@ struct AddrBasedCtxKey : public ContextKey {
return Context == Other->Context;
}
- void genHashCode() override {
- HashCode = hash_combine_range(Context.begin(), Context.end());
- }
+ void genHashCode() override { HashCode = hash_combine_range(Context); }
};
// The counter of branch samples for one function indexed by the branch,
|
|
@llvm/pr-subscribers-lto Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136511.diff 23 Files Affected:
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index 1139fd81cbd07..a1317423cdd1a 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -562,7 +562,7 @@ namespace llvm {
/// @}
template <typename T> hash_code hash_value(ArrayRef<T> S) {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
// Provide DenseMapInfo for ArrayRefs.
diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 9b8643b7765cf..0093c281aac8a 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -649,7 +649,7 @@ template <typename... Ts> hash_code hash_value(const std::tuple<Ts...> &arg) {
// infrastructure is available.
template <typename T>
hash_code hash_value(const std::basic_string<T> &arg) {
- return hash_combine_range(arg.begin(), arg.end());
+ return hash_combine_range(arg);
}
template <typename T> hash_code hash_value(const std::optional<T> &arg) {
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index 9da465ddf75f9..eb1827850567d 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -263,37 +263,35 @@ struct IRInstructionData
OperTypes.push_back(V->getType());
if (isa<CmpInst>(ID.Inst))
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.getPredicate()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.getPredicate()),
+ llvm::hash_combine_range(OperTypes));
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(ID.Inst)) {
// To hash intrinsics, we use the opcode, and types like the other
// instructions, but also, the Intrinsic ID, and the Name of the
// intrinsic.
Intrinsic::ID IntrinsicID = II->getIntrinsicID();
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(IntrinsicID),
- llvm::hash_value(*ID.CalleeName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(IntrinsicID),
+ llvm::hash_value(*ID.CalleeName),
+ llvm::hash_combine_range(OperTypes));
}
if (isa<CallInst>(ID.Inst)) {
std::string FunctionName = *ID.CalleeName;
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(FunctionName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(FunctionName),
+ llvm::hash_combine_range(OperTypes));
}
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_combine_range(OperTypes));
}
IRInstructionDataList *IDL = nullptr;
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index e7b154dff0697..66fe0da21deb7 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -506,7 +506,7 @@ using SampleContextFrames = ArrayRef<SampleContextFrame>;
struct SampleContextFrameHash {
uint64_t operator()(const SampleContextFrameVector &S) const {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
};
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
index e4972cb1cef84..d15a3d777ab0e 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
@@ -119,8 +119,7 @@ struct SpecSig {
}
friend hash_code hash_value(const SpecSig &S) {
- return hash_combine(hash_value(S.Key),
- hash_combine_range(S.Args.begin(), S.Args.end()));
+ return hash_combine(hash_value(S.Key), hash_combine_range(S.Args));
}
};
diff --git a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
index b888b81e92b92..a22cc91b90542 100644
--- a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
+++ b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
@@ -131,7 +131,7 @@ std::string VRegRenamer::getInstructionOpcodeHash(MachineInstr &MI) {
MIOperands.push_back((unsigned)Op->getFailureOrdering());
}
- auto HashMI = hash_combine_range(MIOperands.begin(), MIOperands.end());
+ auto HashMI = hash_combine_range(MIOperands);
OS << format_hex_no_prefix(HashMI, 16, true);
return OS.str();
}
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 33910d0ec6aeb..2bc18001081ea 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -2306,7 +2306,7 @@ MachineInstrExpressionTrait::getHashValue(const MachineInstr* const &MI) {
HashComponents.push_back(hash_value(MO));
}
- return hash_combine_range(HashComponents.begin(), HashComponents.end());
+ return hash_combine_range(HashComponents);
}
const MDNode *MachineInstr::getLocCookieMD() const {
diff --git a/llvm/lib/CodeGen/RegisterBankInfo.cpp b/llvm/lib/CodeGen/RegisterBankInfo.cpp
index eaef13969a7a1..79b3c73ea34f1 100644
--- a/llvm/lib/CodeGen/RegisterBankInfo.cpp
+++ b/llvm/lib/CodeGen/RegisterBankInfo.cpp
@@ -307,7 +307,7 @@ hashValueMapping(const RegisterBankInfo::PartialMapping *BreakDown,
SmallVector<size_t, 8> Hashes(NumBreakDowns);
for (unsigned Idx = 0; Idx != NumBreakDowns; ++Idx)
Hashes.push_back(hash_value(BreakDown[Idx]));
- return hash_combine_range(Hashes.begin(), Hashes.end());
+ return hash_combine_range(Hashes);
}
const RegisterBankInfo::ValueMapping &
diff --git a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
index 1a37469c35d2e..7a105c3a7137a 100644
--- a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
@@ -268,7 +268,7 @@ void IRPartitionLayer::emitPartition(
for (const auto *GV : HashGVs) {
assert(GV->hasName() && "All GVs to extract should be named by now");
auto GVName = GV->getName();
- HC = hash_combine(HC, hash_combine_range(GVName.begin(), GVName.end()));
+ HC = hash_combine(HC, hash_combine_range(GVName));
}
raw_string_ostream(SubModuleName)
<< ".submodule."
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index e5c9622e09927..51fb40bad201d 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -322,9 +322,7 @@ template <class ConstantClass> struct ConstantAggrKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantClass>::TypeClass;
@@ -478,10 +476,8 @@ struct ConstantExprKeyType {
}
unsigned getHash() const {
- return hash_combine(
- Opcode, SubclassOptionalData,
- hash_combine_range(Ops.begin(), Ops.end()),
- hash_combine_range(ShuffleMask.begin(), ShuffleMask.end()), ExplicitTy);
+ return hash_combine(Opcode, SubclassOptionalData, hash_combine_range(Ops),
+ hash_combine_range(ShuffleMask), ExplicitTy);
}
using TypeClass = ConstantInfo<ConstantExpr>::TypeClass;
@@ -537,9 +533,7 @@ struct ConstantPtrAuthKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantPtrAuth>::TypeClass;
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 5e51b3ca4e87d..d8cdbf8370984 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -207,7 +207,7 @@ unsigned MDNodeOpsKey::calculateHash(MDNode *N, unsigned Offset) {
}
unsigned MDNodeOpsKey::calculateHash(ArrayRef<Metadata *> Ops) {
- return hash_combine_range(Ops.begin(), Ops.end());
+ return hash_combine_range(Ops);
}
StringMapEntry<uint32_t> *LLVMContextImpl::getOrInsertBundleTag(StringRef Tag) {
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index efabe40fab192..9b60b57e64130 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -119,8 +119,7 @@ struct AnonStructTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()), Key.isPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.isPacked);
}
static unsigned getHashValue(const StructType *ST) {
@@ -171,9 +170,8 @@ struct FunctionTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.ReturnType,
- hash_combine_range(Key.Params.begin(), Key.Params.end()), Key.isVarArg);
+ return hash_combine(Key.ReturnType, hash_combine_range(Key.Params),
+ Key.isVarArg);
}
static unsigned getHashValue(const FunctionType *FT) {
@@ -219,10 +217,8 @@ struct TargetExtTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.Name,
- hash_combine_range(Key.TypeParams.begin(), Key.TypeParams.end()),
- hash_combine_range(Key.IntParams.begin(), Key.IntParams.end()));
+ return hash_combine(Key.Name, hash_combine_range(Key.TypeParams),
+ hash_combine_range(Key.IntParams));
}
static unsigned getHashValue(const TargetExtType *FT) {
@@ -1324,9 +1320,7 @@ template <> struct MDNodeKeyImpl<DIExpression> {
return Elements == RHS->getElements();
}
- unsigned getHashValue() const {
- return hash_combine_range(Elements.begin(), Elements.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Elements); }
};
template <> struct MDNodeKeyImpl<DIGlobalVariableExpression> {
@@ -1463,9 +1457,7 @@ struct DIArgListKeyInfo {
bool isKeyOf(const DIArgList *RHS) const { return Args == RHS->getArgs(); }
- unsigned getHashValue() const {
- return hash_combine_range(Args.begin(), Args.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Args); }
};
/// DenseMapInfo for DIArgList.
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index e732367b5127e..0f32e9e1a05a5 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1689,8 +1689,7 @@ StructType *IRMover::StructTypeKeyInfo::getTombstoneKey() {
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const KeyTy &Key) {
- return hash_combine(hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()),
- Key.IsPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.IsPacked);
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const StructType *ST) {
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index 4f5fcb4857e80..96829bd062a78 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -613,9 +613,7 @@ bool StringRef::getAsDouble(double &Result, bool AllowInexact) const {
}
// Implementation of StringRef hashing.
-hash_code llvm::hash_value(StringRef S) {
- return hash_combine_range(S.begin(), S.end());
-}
+hash_code llvm::hash_value(StringRef S) { return hash_combine_range(S); }
unsigned DenseMapInfo<StringRef, void>::getHashValue(StringRef Val) {
assert(Val.data() != getEmptyKey().data() &&
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index eec869d57a6db..6c9d499b0e7ea 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1154,9 +1154,9 @@ using PHINodeData = std::pair<ArgLocWithBBCanon, CanonList>;
/// \param PND - The data to hash.
/// \returns The hash code of \p PND.
static hash_code encodePHINodeData(PHINodeData &PND) {
- return llvm::hash_combine(
- llvm::hash_value(PND.first.first), llvm::hash_value(PND.first.second),
- llvm::hash_combine_range(PND.second.begin(), PND.second.end()));
+ return llvm::hash_combine(llvm::hash_value(PND.first.first),
+ llvm::hash_value(PND.first.second),
+ llvm::hash_combine_range(PND.second));
}
/// Create a special GVN for PHINodes that will be used outside of
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 6233e8e2ee681..c0ae944ee82f2 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -165,9 +165,8 @@ struct llvm::GVNPass::Expression {
}
friend hash_code hash_value(const Expression &Value) {
- return hash_combine(
- Value.Opcode, Value.Ty,
- hash_combine_range(Value.VarArgs.begin(), Value.VarArgs.end()));
+ return hash_combine(Value.Opcode, Value.Ty,
+ hash_combine_range(Value.VarArgs));
}
};
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 6f88408abfdbc..2058df33ea331 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -249,7 +249,7 @@ class ModelledPHI {
// Hash functor
unsigned hash() const {
// Is deterministic because Values are saved in a specific order.
- return (unsigned)hash_combine_range(Values.begin(), Values.end());
+ return (unsigned)hash_combine_range(Values);
}
bool operator==(const ModelledPHI &Other) const {
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index ed3709b74d60f..fd16593b2e874 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1291,7 +1291,7 @@ struct UniquifierDenseMapInfo {
}
static unsigned getHashValue(const SmallVector<const SCEV *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<const SCEV *, 4> &LHS,
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index b07f3451420c7..c5c4968ef4dcc 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -553,8 +553,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
std::pair<std::pair<hash_code, DILocalVariable *>, DIExpression *>;
auto makeHash = [](auto *D) -> DbgIntrinsicHash {
auto VarLocOps = D->location_ops();
- return {{hash_combine_range(VarLocOps.begin(), VarLocOps.end()),
- D->getVariable()},
+ return {{hash_combine_range(VarLocOps), D->getVariable()},
D->getExpression()};
};
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 7f53aa7d4f73d..9e6ee58cafc79 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -7469,8 +7469,7 @@ template <> struct DenseMapInfo<const SwitchSuccWrapper *> {
for (PHINode &Phi : BB->phis())
PhiValsForBB.emplace_back((*SSW->PhiPredIVs)[&Phi][BB]);
- return hash_combine(
- BB, hash_combine_range(PhiValsForBB.begin(), PhiValsForBB.end()));
+ return hash_combine(BB, hash_combine_range(PhiValsForBB));
}
static bool isEqual(const SwitchSuccWrapper *LHS,
const SwitchSuccWrapper *RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 70cd201ab20a6..a56728226c039 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5085,7 +5085,7 @@ class BoUpSLP {
}
static unsigned getHashValue(const OrdersType &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const OrdersType &LHS, const OrdersType &RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.h b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
index 7f123689170ad..2b927b93e24cf 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanSLP.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
@@ -85,7 +85,7 @@ class VPlanSlp {
}
static unsigned getHashValue(const SmallVector<VPValue *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<VPValue *, 4> &LHS,
diff --git a/llvm/tools/llvm-profgen/PerfReader.h b/llvm/tools/llvm-profgen/PerfReader.h
index a3bd7a0a6493e..4b3ac8f569755 100644
--- a/llvm/tools/llvm-profgen/PerfReader.h
+++ b/llvm/tools/llvm-profgen/PerfReader.h
@@ -386,9 +386,7 @@ struct AddrBasedCtxKey : public ContextKey {
return Context == Other->Context;
}
- void genHashCode() override {
- HashCode = hash_combine_range(Context.begin(), Context.end());
- }
+ void genHashCode() override { HashCode = hash_combine_range(Context); }
};
// The counter of branch samples for one function indexed by the branch,
|
|
@llvm/pr-subscribers-pgo Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136511.diff 23 Files Affected:
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index 1139fd81cbd07..a1317423cdd1a 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -562,7 +562,7 @@ namespace llvm {
/// @}
template <typename T> hash_code hash_value(ArrayRef<T> S) {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
// Provide DenseMapInfo for ArrayRefs.
diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 9b8643b7765cf..0093c281aac8a 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -649,7 +649,7 @@ template <typename... Ts> hash_code hash_value(const std::tuple<Ts...> &arg) {
// infrastructure is available.
template <typename T>
hash_code hash_value(const std::basic_string<T> &arg) {
- return hash_combine_range(arg.begin(), arg.end());
+ return hash_combine_range(arg);
}
template <typename T> hash_code hash_value(const std::optional<T> &arg) {
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index 9da465ddf75f9..eb1827850567d 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -263,37 +263,35 @@ struct IRInstructionData
OperTypes.push_back(V->getType());
if (isa<CmpInst>(ID.Inst))
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.getPredicate()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.getPredicate()),
+ llvm::hash_combine_range(OperTypes));
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(ID.Inst)) {
// To hash intrinsics, we use the opcode, and types like the other
// instructions, but also, the Intrinsic ID, and the Name of the
// intrinsic.
Intrinsic::ID IntrinsicID = II->getIntrinsicID();
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(IntrinsicID),
- llvm::hash_value(*ID.CalleeName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(IntrinsicID),
+ llvm::hash_value(*ID.CalleeName),
+ llvm::hash_combine_range(OperTypes));
}
if (isa<CallInst>(ID.Inst)) {
std::string FunctionName = *ID.CalleeName;
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(FunctionName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(FunctionName),
+ llvm::hash_combine_range(OperTypes));
}
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_combine_range(OperTypes));
}
IRInstructionDataList *IDL = nullptr;
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index e7b154dff0697..66fe0da21deb7 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -506,7 +506,7 @@ using SampleContextFrames = ArrayRef<SampleContextFrame>;
struct SampleContextFrameHash {
uint64_t operator()(const SampleContextFrameVector &S) const {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
};
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
index e4972cb1cef84..d15a3d777ab0e 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
@@ -119,8 +119,7 @@ struct SpecSig {
}
friend hash_code hash_value(const SpecSig &S) {
- return hash_combine(hash_value(S.Key),
- hash_combine_range(S.Args.begin(), S.Args.end()));
+ return hash_combine(hash_value(S.Key), hash_combine_range(S.Args));
}
};
diff --git a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
index b888b81e92b92..a22cc91b90542 100644
--- a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
+++ b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
@@ -131,7 +131,7 @@ std::string VRegRenamer::getInstructionOpcodeHash(MachineInstr &MI) {
MIOperands.push_back((unsigned)Op->getFailureOrdering());
}
- auto HashMI = hash_combine_range(MIOperands.begin(), MIOperands.end());
+ auto HashMI = hash_combine_range(MIOperands);
OS << format_hex_no_prefix(HashMI, 16, true);
return OS.str();
}
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 33910d0ec6aeb..2bc18001081ea 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -2306,7 +2306,7 @@ MachineInstrExpressionTrait::getHashValue(const MachineInstr* const &MI) {
HashComponents.push_back(hash_value(MO));
}
- return hash_combine_range(HashComponents.begin(), HashComponents.end());
+ return hash_combine_range(HashComponents);
}
const MDNode *MachineInstr::getLocCookieMD() const {
diff --git a/llvm/lib/CodeGen/RegisterBankInfo.cpp b/llvm/lib/CodeGen/RegisterBankInfo.cpp
index eaef13969a7a1..79b3c73ea34f1 100644
--- a/llvm/lib/CodeGen/RegisterBankInfo.cpp
+++ b/llvm/lib/CodeGen/RegisterBankInfo.cpp
@@ -307,7 +307,7 @@ hashValueMapping(const RegisterBankInfo::PartialMapping *BreakDown,
SmallVector<size_t, 8> Hashes(NumBreakDowns);
for (unsigned Idx = 0; Idx != NumBreakDowns; ++Idx)
Hashes.push_back(hash_value(BreakDown[Idx]));
- return hash_combine_range(Hashes.begin(), Hashes.end());
+ return hash_combine_range(Hashes);
}
const RegisterBankInfo::ValueMapping &
diff --git a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
index 1a37469c35d2e..7a105c3a7137a 100644
--- a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
@@ -268,7 +268,7 @@ void IRPartitionLayer::emitPartition(
for (const auto *GV : HashGVs) {
assert(GV->hasName() && "All GVs to extract should be named by now");
auto GVName = GV->getName();
- HC = hash_combine(HC, hash_combine_range(GVName.begin(), GVName.end()));
+ HC = hash_combine(HC, hash_combine_range(GVName));
}
raw_string_ostream(SubModuleName)
<< ".submodule."
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index e5c9622e09927..51fb40bad201d 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -322,9 +322,7 @@ template <class ConstantClass> struct ConstantAggrKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantClass>::TypeClass;
@@ -478,10 +476,8 @@ struct ConstantExprKeyType {
}
unsigned getHash() const {
- return hash_combine(
- Opcode, SubclassOptionalData,
- hash_combine_range(Ops.begin(), Ops.end()),
- hash_combine_range(ShuffleMask.begin(), ShuffleMask.end()), ExplicitTy);
+ return hash_combine(Opcode, SubclassOptionalData, hash_combine_range(Ops),
+ hash_combine_range(ShuffleMask), ExplicitTy);
}
using TypeClass = ConstantInfo<ConstantExpr>::TypeClass;
@@ -537,9 +533,7 @@ struct ConstantPtrAuthKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantPtrAuth>::TypeClass;
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 5e51b3ca4e87d..d8cdbf8370984 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -207,7 +207,7 @@ unsigned MDNodeOpsKey::calculateHash(MDNode *N, unsigned Offset) {
}
unsigned MDNodeOpsKey::calculateHash(ArrayRef<Metadata *> Ops) {
- return hash_combine_range(Ops.begin(), Ops.end());
+ return hash_combine_range(Ops);
}
StringMapEntry<uint32_t> *LLVMContextImpl::getOrInsertBundleTag(StringRef Tag) {
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index efabe40fab192..9b60b57e64130 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -119,8 +119,7 @@ struct AnonStructTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()), Key.isPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.isPacked);
}
static unsigned getHashValue(const StructType *ST) {
@@ -171,9 +170,8 @@ struct FunctionTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.ReturnType,
- hash_combine_range(Key.Params.begin(), Key.Params.end()), Key.isVarArg);
+ return hash_combine(Key.ReturnType, hash_combine_range(Key.Params),
+ Key.isVarArg);
}
static unsigned getHashValue(const FunctionType *FT) {
@@ -219,10 +217,8 @@ struct TargetExtTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.Name,
- hash_combine_range(Key.TypeParams.begin(), Key.TypeParams.end()),
- hash_combine_range(Key.IntParams.begin(), Key.IntParams.end()));
+ return hash_combine(Key.Name, hash_combine_range(Key.TypeParams),
+ hash_combine_range(Key.IntParams));
}
static unsigned getHashValue(const TargetExtType *FT) {
@@ -1324,9 +1320,7 @@ template <> struct MDNodeKeyImpl<DIExpression> {
return Elements == RHS->getElements();
}
- unsigned getHashValue() const {
- return hash_combine_range(Elements.begin(), Elements.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Elements); }
};
template <> struct MDNodeKeyImpl<DIGlobalVariableExpression> {
@@ -1463,9 +1457,7 @@ struct DIArgListKeyInfo {
bool isKeyOf(const DIArgList *RHS) const { return Args == RHS->getArgs(); }
- unsigned getHashValue() const {
- return hash_combine_range(Args.begin(), Args.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Args); }
};
/// DenseMapInfo for DIArgList.
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index e732367b5127e..0f32e9e1a05a5 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1689,8 +1689,7 @@ StructType *IRMover::StructTypeKeyInfo::getTombstoneKey() {
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const KeyTy &Key) {
- return hash_combine(hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()),
- Key.IsPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.IsPacked);
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const StructType *ST) {
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index 4f5fcb4857e80..96829bd062a78 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -613,9 +613,7 @@ bool StringRef::getAsDouble(double &Result, bool AllowInexact) const {
}
// Implementation of StringRef hashing.
-hash_code llvm::hash_value(StringRef S) {
- return hash_combine_range(S.begin(), S.end());
-}
+hash_code llvm::hash_value(StringRef S) { return hash_combine_range(S); }
unsigned DenseMapInfo<StringRef, void>::getHashValue(StringRef Val) {
assert(Val.data() != getEmptyKey().data() &&
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index eec869d57a6db..6c9d499b0e7ea 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1154,9 +1154,9 @@ using PHINodeData = std::pair<ArgLocWithBBCanon, CanonList>;
/// \param PND - The data to hash.
/// \returns The hash code of \p PND.
static hash_code encodePHINodeData(PHINodeData &PND) {
- return llvm::hash_combine(
- llvm::hash_value(PND.first.first), llvm::hash_value(PND.first.second),
- llvm::hash_combine_range(PND.second.begin(), PND.second.end()));
+ return llvm::hash_combine(llvm::hash_value(PND.first.first),
+ llvm::hash_value(PND.first.second),
+ llvm::hash_combine_range(PND.second));
}
/// Create a special GVN for PHINodes that will be used outside of
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 6233e8e2ee681..c0ae944ee82f2 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -165,9 +165,8 @@ struct llvm::GVNPass::Expression {
}
friend hash_code hash_value(const Expression &Value) {
- return hash_combine(
- Value.Opcode, Value.Ty,
- hash_combine_range(Value.VarArgs.begin(), Value.VarArgs.end()));
+ return hash_combine(Value.Opcode, Value.Ty,
+ hash_combine_range(Value.VarArgs));
}
};
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 6f88408abfdbc..2058df33ea331 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -249,7 +249,7 @@ class ModelledPHI {
// Hash functor
unsigned hash() const {
// Is deterministic because Values are saved in a specific order.
- return (unsigned)hash_combine_range(Values.begin(), Values.end());
+ return (unsigned)hash_combine_range(Values);
}
bool operator==(const ModelledPHI &Other) const {
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index ed3709b74d60f..fd16593b2e874 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1291,7 +1291,7 @@ struct UniquifierDenseMapInfo {
}
static unsigned getHashValue(const SmallVector<const SCEV *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<const SCEV *, 4> &LHS,
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index b07f3451420c7..c5c4968ef4dcc 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -553,8 +553,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
std::pair<std::pair<hash_code, DILocalVariable *>, DIExpression *>;
auto makeHash = [](auto *D) -> DbgIntrinsicHash {
auto VarLocOps = D->location_ops();
- return {{hash_combine_range(VarLocOps.begin(), VarLocOps.end()),
- D->getVariable()},
+ return {{hash_combine_range(VarLocOps), D->getVariable()},
D->getExpression()};
};
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 7f53aa7d4f73d..9e6ee58cafc79 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -7469,8 +7469,7 @@ template <> struct DenseMapInfo<const SwitchSuccWrapper *> {
for (PHINode &Phi : BB->phis())
PhiValsForBB.emplace_back((*SSW->PhiPredIVs)[&Phi][BB]);
- return hash_combine(
- BB, hash_combine_range(PhiValsForBB.begin(), PhiValsForBB.end()));
+ return hash_combine(BB, hash_combine_range(PhiValsForBB));
}
static bool isEqual(const SwitchSuccWrapper *LHS,
const SwitchSuccWrapper *RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 70cd201ab20a6..a56728226c039 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5085,7 +5085,7 @@ class BoUpSLP {
}
static unsigned getHashValue(const OrdersType &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const OrdersType &LHS, const OrdersType &RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.h b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
index 7f123689170ad..2b927b93e24cf 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanSLP.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
@@ -85,7 +85,7 @@ class VPlanSlp {
}
static unsigned getHashValue(const SmallVector<VPValue *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<VPValue *, 4> &LHS,
diff --git a/llvm/tools/llvm-profgen/PerfReader.h b/llvm/tools/llvm-profgen/PerfReader.h
index a3bd7a0a6493e..4b3ac8f569755 100644
--- a/llvm/tools/llvm-profgen/PerfReader.h
+++ b/llvm/tools/llvm-profgen/PerfReader.h
@@ -386,9 +386,7 @@ struct AddrBasedCtxKey : public ContextKey {
return Context == Other->Context;
}
- void genHashCode() override {
- HashCode = hash_combine_range(Context.begin(), Context.end());
- }
+ void genHashCode() override { HashCode = hash_combine_range(Context); }
};
// The counter of branch samples for one function indexed by the branch,
|
|
@llvm/pr-subscribers-llvm-analysis Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136511.diff 23 Files Affected:
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index 1139fd81cbd07..a1317423cdd1a 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -562,7 +562,7 @@ namespace llvm {
/// @}
template <typename T> hash_code hash_value(ArrayRef<T> S) {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
// Provide DenseMapInfo for ArrayRefs.
diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 9b8643b7765cf..0093c281aac8a 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -649,7 +649,7 @@ template <typename... Ts> hash_code hash_value(const std::tuple<Ts...> &arg) {
// infrastructure is available.
template <typename T>
hash_code hash_value(const std::basic_string<T> &arg) {
- return hash_combine_range(arg.begin(), arg.end());
+ return hash_combine_range(arg);
}
template <typename T> hash_code hash_value(const std::optional<T> &arg) {
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index 9da465ddf75f9..eb1827850567d 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -263,37 +263,35 @@ struct IRInstructionData
OperTypes.push_back(V->getType());
if (isa<CmpInst>(ID.Inst))
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.getPredicate()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.getPredicate()),
+ llvm::hash_combine_range(OperTypes));
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(ID.Inst)) {
// To hash intrinsics, we use the opcode, and types like the other
// instructions, but also, the Intrinsic ID, and the Name of the
// intrinsic.
Intrinsic::ID IntrinsicID = II->getIntrinsicID();
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(IntrinsicID),
- llvm::hash_value(*ID.CalleeName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(IntrinsicID),
+ llvm::hash_value(*ID.CalleeName),
+ llvm::hash_combine_range(OperTypes));
}
if (isa<CallInst>(ID.Inst)) {
std::string FunctionName = *ID.CalleeName;
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(FunctionName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(FunctionName),
+ llvm::hash_combine_range(OperTypes));
}
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_combine_range(OperTypes));
}
IRInstructionDataList *IDL = nullptr;
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index e7b154dff0697..66fe0da21deb7 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -506,7 +506,7 @@ using SampleContextFrames = ArrayRef<SampleContextFrame>;
struct SampleContextFrameHash {
uint64_t operator()(const SampleContextFrameVector &S) const {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
};
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
index e4972cb1cef84..d15a3d777ab0e 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
@@ -119,8 +119,7 @@ struct SpecSig {
}
friend hash_code hash_value(const SpecSig &S) {
- return hash_combine(hash_value(S.Key),
- hash_combine_range(S.Args.begin(), S.Args.end()));
+ return hash_combine(hash_value(S.Key), hash_combine_range(S.Args));
}
};
diff --git a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
index b888b81e92b92..a22cc91b90542 100644
--- a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
+++ b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
@@ -131,7 +131,7 @@ std::string VRegRenamer::getInstructionOpcodeHash(MachineInstr &MI) {
MIOperands.push_back((unsigned)Op->getFailureOrdering());
}
- auto HashMI = hash_combine_range(MIOperands.begin(), MIOperands.end());
+ auto HashMI = hash_combine_range(MIOperands);
OS << format_hex_no_prefix(HashMI, 16, true);
return OS.str();
}
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 33910d0ec6aeb..2bc18001081ea 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -2306,7 +2306,7 @@ MachineInstrExpressionTrait::getHashValue(const MachineInstr* const &MI) {
HashComponents.push_back(hash_value(MO));
}
- return hash_combine_range(HashComponents.begin(), HashComponents.end());
+ return hash_combine_range(HashComponents);
}
const MDNode *MachineInstr::getLocCookieMD() const {
diff --git a/llvm/lib/CodeGen/RegisterBankInfo.cpp b/llvm/lib/CodeGen/RegisterBankInfo.cpp
index eaef13969a7a1..79b3c73ea34f1 100644
--- a/llvm/lib/CodeGen/RegisterBankInfo.cpp
+++ b/llvm/lib/CodeGen/RegisterBankInfo.cpp
@@ -307,7 +307,7 @@ hashValueMapping(const RegisterBankInfo::PartialMapping *BreakDown,
SmallVector<size_t, 8> Hashes(NumBreakDowns);
for (unsigned Idx = 0; Idx != NumBreakDowns; ++Idx)
Hashes.push_back(hash_value(BreakDown[Idx]));
- return hash_combine_range(Hashes.begin(), Hashes.end());
+ return hash_combine_range(Hashes);
}
const RegisterBankInfo::ValueMapping &
diff --git a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
index 1a37469c35d2e..7a105c3a7137a 100644
--- a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
@@ -268,7 +268,7 @@ void IRPartitionLayer::emitPartition(
for (const auto *GV : HashGVs) {
assert(GV->hasName() && "All GVs to extract should be named by now");
auto GVName = GV->getName();
- HC = hash_combine(HC, hash_combine_range(GVName.begin(), GVName.end()));
+ HC = hash_combine(HC, hash_combine_range(GVName));
}
raw_string_ostream(SubModuleName)
<< ".submodule."
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index e5c9622e09927..51fb40bad201d 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -322,9 +322,7 @@ template <class ConstantClass> struct ConstantAggrKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantClass>::TypeClass;
@@ -478,10 +476,8 @@ struct ConstantExprKeyType {
}
unsigned getHash() const {
- return hash_combine(
- Opcode, SubclassOptionalData,
- hash_combine_range(Ops.begin(), Ops.end()),
- hash_combine_range(ShuffleMask.begin(), ShuffleMask.end()), ExplicitTy);
+ return hash_combine(Opcode, SubclassOptionalData, hash_combine_range(Ops),
+ hash_combine_range(ShuffleMask), ExplicitTy);
}
using TypeClass = ConstantInfo<ConstantExpr>::TypeClass;
@@ -537,9 +533,7 @@ struct ConstantPtrAuthKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantPtrAuth>::TypeClass;
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 5e51b3ca4e87d..d8cdbf8370984 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -207,7 +207,7 @@ unsigned MDNodeOpsKey::calculateHash(MDNode *N, unsigned Offset) {
}
unsigned MDNodeOpsKey::calculateHash(ArrayRef<Metadata *> Ops) {
- return hash_combine_range(Ops.begin(), Ops.end());
+ return hash_combine_range(Ops);
}
StringMapEntry<uint32_t> *LLVMContextImpl::getOrInsertBundleTag(StringRef Tag) {
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index efabe40fab192..9b60b57e64130 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -119,8 +119,7 @@ struct AnonStructTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()), Key.isPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.isPacked);
}
static unsigned getHashValue(const StructType *ST) {
@@ -171,9 +170,8 @@ struct FunctionTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.ReturnType,
- hash_combine_range(Key.Params.begin(), Key.Params.end()), Key.isVarArg);
+ return hash_combine(Key.ReturnType, hash_combine_range(Key.Params),
+ Key.isVarArg);
}
static unsigned getHashValue(const FunctionType *FT) {
@@ -219,10 +217,8 @@ struct TargetExtTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.Name,
- hash_combine_range(Key.TypeParams.begin(), Key.TypeParams.end()),
- hash_combine_range(Key.IntParams.begin(), Key.IntParams.end()));
+ return hash_combine(Key.Name, hash_combine_range(Key.TypeParams),
+ hash_combine_range(Key.IntParams));
}
static unsigned getHashValue(const TargetExtType *FT) {
@@ -1324,9 +1320,7 @@ template <> struct MDNodeKeyImpl<DIExpression> {
return Elements == RHS->getElements();
}
- unsigned getHashValue() const {
- return hash_combine_range(Elements.begin(), Elements.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Elements); }
};
template <> struct MDNodeKeyImpl<DIGlobalVariableExpression> {
@@ -1463,9 +1457,7 @@ struct DIArgListKeyInfo {
bool isKeyOf(const DIArgList *RHS) const { return Args == RHS->getArgs(); }
- unsigned getHashValue() const {
- return hash_combine_range(Args.begin(), Args.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Args); }
};
/// DenseMapInfo for DIArgList.
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index e732367b5127e..0f32e9e1a05a5 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1689,8 +1689,7 @@ StructType *IRMover::StructTypeKeyInfo::getTombstoneKey() {
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const KeyTy &Key) {
- return hash_combine(hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()),
- Key.IsPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.IsPacked);
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const StructType *ST) {
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index 4f5fcb4857e80..96829bd062a78 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -613,9 +613,7 @@ bool StringRef::getAsDouble(double &Result, bool AllowInexact) const {
}
// Implementation of StringRef hashing.
-hash_code llvm::hash_value(StringRef S) {
- return hash_combine_range(S.begin(), S.end());
-}
+hash_code llvm::hash_value(StringRef S) { return hash_combine_range(S); }
unsigned DenseMapInfo<StringRef, void>::getHashValue(StringRef Val) {
assert(Val.data() != getEmptyKey().data() &&
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index eec869d57a6db..6c9d499b0e7ea 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1154,9 +1154,9 @@ using PHINodeData = std::pair<ArgLocWithBBCanon, CanonList>;
/// \param PND - The data to hash.
/// \returns The hash code of \p PND.
static hash_code encodePHINodeData(PHINodeData &PND) {
- return llvm::hash_combine(
- llvm::hash_value(PND.first.first), llvm::hash_value(PND.first.second),
- llvm::hash_combine_range(PND.second.begin(), PND.second.end()));
+ return llvm::hash_combine(llvm::hash_value(PND.first.first),
+ llvm::hash_value(PND.first.second),
+ llvm::hash_combine_range(PND.second));
}
/// Create a special GVN for PHINodes that will be used outside of
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 6233e8e2ee681..c0ae944ee82f2 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -165,9 +165,8 @@ struct llvm::GVNPass::Expression {
}
friend hash_code hash_value(const Expression &Value) {
- return hash_combine(
- Value.Opcode, Value.Ty,
- hash_combine_range(Value.VarArgs.begin(), Value.VarArgs.end()));
+ return hash_combine(Value.Opcode, Value.Ty,
+ hash_combine_range(Value.VarArgs));
}
};
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 6f88408abfdbc..2058df33ea331 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -249,7 +249,7 @@ class ModelledPHI {
// Hash functor
unsigned hash() const {
// Is deterministic because Values are saved in a specific order.
- return (unsigned)hash_combine_range(Values.begin(), Values.end());
+ return (unsigned)hash_combine_range(Values);
}
bool operator==(const ModelledPHI &Other) const {
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index ed3709b74d60f..fd16593b2e874 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1291,7 +1291,7 @@ struct UniquifierDenseMapInfo {
}
static unsigned getHashValue(const SmallVector<const SCEV *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<const SCEV *, 4> &LHS,
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index b07f3451420c7..c5c4968ef4dcc 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -553,8 +553,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
std::pair<std::pair<hash_code, DILocalVariable *>, DIExpression *>;
auto makeHash = [](auto *D) -> DbgIntrinsicHash {
auto VarLocOps = D->location_ops();
- return {{hash_combine_range(VarLocOps.begin(), VarLocOps.end()),
- D->getVariable()},
+ return {{hash_combine_range(VarLocOps), D->getVariable()},
D->getExpression()};
};
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 7f53aa7d4f73d..9e6ee58cafc79 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -7469,8 +7469,7 @@ template <> struct DenseMapInfo<const SwitchSuccWrapper *> {
for (PHINode &Phi : BB->phis())
PhiValsForBB.emplace_back((*SSW->PhiPredIVs)[&Phi][BB]);
- return hash_combine(
- BB, hash_combine_range(PhiValsForBB.begin(), PhiValsForBB.end()));
+ return hash_combine(BB, hash_combine_range(PhiValsForBB));
}
static bool isEqual(const SwitchSuccWrapper *LHS,
const SwitchSuccWrapper *RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 70cd201ab20a6..a56728226c039 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5085,7 +5085,7 @@ class BoUpSLP {
}
static unsigned getHashValue(const OrdersType &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const OrdersType &LHS, const OrdersType &RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.h b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
index 7f123689170ad..2b927b93e24cf 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanSLP.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
@@ -85,7 +85,7 @@ class VPlanSlp {
}
static unsigned getHashValue(const SmallVector<VPValue *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<VPValue *, 4> &LHS,
diff --git a/llvm/tools/llvm-profgen/PerfReader.h b/llvm/tools/llvm-profgen/PerfReader.h
index a3bd7a0a6493e..4b3ac8f569755 100644
--- a/llvm/tools/llvm-profgen/PerfReader.h
+++ b/llvm/tools/llvm-profgen/PerfReader.h
@@ -386,9 +386,7 @@ struct AddrBasedCtxKey : public ContextKey {
return Context == Other->Context;
}
- void genHashCode() override {
- HashCode = hash_combine_range(Context.begin(), Context.end());
- }
+ void genHashCode() override { HashCode = hash_combine_range(Context); }
};
// The counter of branch samples for one function indexed by the branch,
|
|
@llvm/pr-subscribers-llvm-support Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/136511.diff 23 Files Affected:
diff --git a/llvm/include/llvm/ADT/ArrayRef.h b/llvm/include/llvm/ADT/ArrayRef.h
index 1139fd81cbd07..a1317423cdd1a 100644
--- a/llvm/include/llvm/ADT/ArrayRef.h
+++ b/llvm/include/llvm/ADT/ArrayRef.h
@@ -562,7 +562,7 @@ namespace llvm {
/// @}
template <typename T> hash_code hash_value(ArrayRef<T> S) {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
// Provide DenseMapInfo for ArrayRefs.
diff --git a/llvm/include/llvm/ADT/Hashing.h b/llvm/include/llvm/ADT/Hashing.h
index 9b8643b7765cf..0093c281aac8a 100644
--- a/llvm/include/llvm/ADT/Hashing.h
+++ b/llvm/include/llvm/ADT/Hashing.h
@@ -649,7 +649,7 @@ template <typename... Ts> hash_code hash_value(const std::tuple<Ts...> &arg) {
// infrastructure is available.
template <typename T>
hash_code hash_value(const std::basic_string<T> &arg) {
- return hash_combine_range(arg.begin(), arg.end());
+ return hash_combine_range(arg);
}
template <typename T> hash_code hash_value(const std::optional<T> &arg) {
diff --git a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
index 9da465ddf75f9..eb1827850567d 100644
--- a/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
+++ b/llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
@@ -263,37 +263,35 @@ struct IRInstructionData
OperTypes.push_back(V->getType());
if (isa<CmpInst>(ID.Inst))
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.getPredicate()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.getPredicate()),
+ llvm::hash_combine_range(OperTypes));
if (IntrinsicInst *II = dyn_cast<IntrinsicInst>(ID.Inst)) {
// To hash intrinsics, we use the opcode, and types like the other
// instructions, but also, the Intrinsic ID, and the Name of the
// intrinsic.
Intrinsic::ID IntrinsicID = II->getIntrinsicID();
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(IntrinsicID),
- llvm::hash_value(*ID.CalleeName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(IntrinsicID),
+ llvm::hash_value(*ID.CalleeName),
+ llvm::hash_combine_range(OperTypes));
}
if (isa<CallInst>(ID.Inst)) {
std::string FunctionName = *ID.CalleeName;
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_value(ID.Inst->getType()), llvm::hash_value(FunctionName),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_value(FunctionName),
+ llvm::hash_combine_range(OperTypes));
}
- return llvm::hash_combine(
- llvm::hash_value(ID.Inst->getOpcode()),
- llvm::hash_value(ID.Inst->getType()),
- llvm::hash_combine_range(OperTypes.begin(), OperTypes.end()));
+ return llvm::hash_combine(llvm::hash_value(ID.Inst->getOpcode()),
+ llvm::hash_value(ID.Inst->getType()),
+ llvm::hash_combine_range(OperTypes));
}
IRInstructionDataList *IDL = nullptr;
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index e7b154dff0697..66fe0da21deb7 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -506,7 +506,7 @@ using SampleContextFrames = ArrayRef<SampleContextFrame>;
struct SampleContextFrameHash {
uint64_t operator()(const SampleContextFrameVector &S) const {
- return hash_combine_range(S.begin(), S.end());
+ return hash_combine_range(S);
}
};
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
index e4972cb1cef84..d15a3d777ab0e 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
@@ -119,8 +119,7 @@ struct SpecSig {
}
friend hash_code hash_value(const SpecSig &S) {
- return hash_combine(hash_value(S.Key),
- hash_combine_range(S.Args.begin(), S.Args.end()));
+ return hash_combine(hash_value(S.Key), hash_combine_range(S.Args));
}
};
diff --git a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
index b888b81e92b92..a22cc91b90542 100644
--- a/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
+++ b/llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
@@ -131,7 +131,7 @@ std::string VRegRenamer::getInstructionOpcodeHash(MachineInstr &MI) {
MIOperands.push_back((unsigned)Op->getFailureOrdering());
}
- auto HashMI = hash_combine_range(MIOperands.begin(), MIOperands.end());
+ auto HashMI = hash_combine_range(MIOperands);
OS << format_hex_no_prefix(HashMI, 16, true);
return OS.str();
}
diff --git a/llvm/lib/CodeGen/MachineInstr.cpp b/llvm/lib/CodeGen/MachineInstr.cpp
index 33910d0ec6aeb..2bc18001081ea 100644
--- a/llvm/lib/CodeGen/MachineInstr.cpp
+++ b/llvm/lib/CodeGen/MachineInstr.cpp
@@ -2306,7 +2306,7 @@ MachineInstrExpressionTrait::getHashValue(const MachineInstr* const &MI) {
HashComponents.push_back(hash_value(MO));
}
- return hash_combine_range(HashComponents.begin(), HashComponents.end());
+ return hash_combine_range(HashComponents);
}
const MDNode *MachineInstr::getLocCookieMD() const {
diff --git a/llvm/lib/CodeGen/RegisterBankInfo.cpp b/llvm/lib/CodeGen/RegisterBankInfo.cpp
index eaef13969a7a1..79b3c73ea34f1 100644
--- a/llvm/lib/CodeGen/RegisterBankInfo.cpp
+++ b/llvm/lib/CodeGen/RegisterBankInfo.cpp
@@ -307,7 +307,7 @@ hashValueMapping(const RegisterBankInfo::PartialMapping *BreakDown,
SmallVector<size_t, 8> Hashes(NumBreakDowns);
for (unsigned Idx = 0; Idx != NumBreakDowns; ++Idx)
Hashes.push_back(hash_value(BreakDown[Idx]));
- return hash_combine_range(Hashes.begin(), Hashes.end());
+ return hash_combine_range(Hashes);
}
const RegisterBankInfo::ValueMapping &
diff --git a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
index 1a37469c35d2e..7a105c3a7137a 100644
--- a/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
@@ -268,7 +268,7 @@ void IRPartitionLayer::emitPartition(
for (const auto *GV : HashGVs) {
assert(GV->hasName() && "All GVs to extract should be named by now");
auto GVName = GV->getName();
- HC = hash_combine(HC, hash_combine_range(GVName.begin(), GVName.end()));
+ HC = hash_combine(HC, hash_combine_range(GVName));
}
raw_string_ostream(SubModuleName)
<< ".submodule."
diff --git a/llvm/lib/IR/ConstantsContext.h b/llvm/lib/IR/ConstantsContext.h
index e5c9622e09927..51fb40bad201d 100644
--- a/llvm/lib/IR/ConstantsContext.h
+++ b/llvm/lib/IR/ConstantsContext.h
@@ -322,9 +322,7 @@ template <class ConstantClass> struct ConstantAggrKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantClass>::TypeClass;
@@ -478,10 +476,8 @@ struct ConstantExprKeyType {
}
unsigned getHash() const {
- return hash_combine(
- Opcode, SubclassOptionalData,
- hash_combine_range(Ops.begin(), Ops.end()),
- hash_combine_range(ShuffleMask.begin(), ShuffleMask.end()), ExplicitTy);
+ return hash_combine(Opcode, SubclassOptionalData, hash_combine_range(Ops),
+ hash_combine_range(ShuffleMask), ExplicitTy);
}
using TypeClass = ConstantInfo<ConstantExpr>::TypeClass;
@@ -537,9 +533,7 @@ struct ConstantPtrAuthKeyType {
return true;
}
- unsigned getHash() const {
- return hash_combine_range(Operands.begin(), Operands.end());
- }
+ unsigned getHash() const { return hash_combine_range(Operands); }
using TypeClass = typename ConstantInfo<ConstantPtrAuth>::TypeClass;
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index 5e51b3ca4e87d..d8cdbf8370984 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -207,7 +207,7 @@ unsigned MDNodeOpsKey::calculateHash(MDNode *N, unsigned Offset) {
}
unsigned MDNodeOpsKey::calculateHash(ArrayRef<Metadata *> Ops) {
- return hash_combine_range(Ops.begin(), Ops.end());
+ return hash_combine_range(Ops);
}
StringMapEntry<uint32_t> *LLVMContextImpl::getOrInsertBundleTag(StringRef Tag) {
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index efabe40fab192..9b60b57e64130 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -119,8 +119,7 @@ struct AnonStructTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()), Key.isPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.isPacked);
}
static unsigned getHashValue(const StructType *ST) {
@@ -171,9 +170,8 @@ struct FunctionTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.ReturnType,
- hash_combine_range(Key.Params.begin(), Key.Params.end()), Key.isVarArg);
+ return hash_combine(Key.ReturnType, hash_combine_range(Key.Params),
+ Key.isVarArg);
}
static unsigned getHashValue(const FunctionType *FT) {
@@ -219,10 +217,8 @@ struct TargetExtTypeKeyInfo {
}
static unsigned getHashValue(const KeyTy &Key) {
- return hash_combine(
- Key.Name,
- hash_combine_range(Key.TypeParams.begin(), Key.TypeParams.end()),
- hash_combine_range(Key.IntParams.begin(), Key.IntParams.end()));
+ return hash_combine(Key.Name, hash_combine_range(Key.TypeParams),
+ hash_combine_range(Key.IntParams));
}
static unsigned getHashValue(const TargetExtType *FT) {
@@ -1324,9 +1320,7 @@ template <> struct MDNodeKeyImpl<DIExpression> {
return Elements == RHS->getElements();
}
- unsigned getHashValue() const {
- return hash_combine_range(Elements.begin(), Elements.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Elements); }
};
template <> struct MDNodeKeyImpl<DIGlobalVariableExpression> {
@@ -1463,9 +1457,7 @@ struct DIArgListKeyInfo {
bool isKeyOf(const DIArgList *RHS) const { return Args == RHS->getArgs(); }
- unsigned getHashValue() const {
- return hash_combine_range(Args.begin(), Args.end());
- }
+ unsigned getHashValue() const { return hash_combine_range(Args); }
};
/// DenseMapInfo for DIArgList.
diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp
index e732367b5127e..0f32e9e1a05a5 100644
--- a/llvm/lib/Linker/IRMover.cpp
+++ b/llvm/lib/Linker/IRMover.cpp
@@ -1689,8 +1689,7 @@ StructType *IRMover::StructTypeKeyInfo::getTombstoneKey() {
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const KeyTy &Key) {
- return hash_combine(hash_combine_range(Key.ETypes.begin(), Key.ETypes.end()),
- Key.IsPacked);
+ return hash_combine(hash_combine_range(Key.ETypes), Key.IsPacked);
}
unsigned IRMover::StructTypeKeyInfo::getHashValue(const StructType *ST) {
diff --git a/llvm/lib/Support/StringRef.cpp b/llvm/lib/Support/StringRef.cpp
index 4f5fcb4857e80..96829bd062a78 100644
--- a/llvm/lib/Support/StringRef.cpp
+++ b/llvm/lib/Support/StringRef.cpp
@@ -613,9 +613,7 @@ bool StringRef::getAsDouble(double &Result, bool AllowInexact) const {
}
// Implementation of StringRef hashing.
-hash_code llvm::hash_value(StringRef S) {
- return hash_combine_range(S.begin(), S.end());
-}
+hash_code llvm::hash_value(StringRef S) { return hash_combine_range(S); }
unsigned DenseMapInfo<StringRef, void>::getHashValue(StringRef Val) {
assert(Val.data() != getEmptyKey().data() &&
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index eec869d57a6db..6c9d499b0e7ea 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -1154,9 +1154,9 @@ using PHINodeData = std::pair<ArgLocWithBBCanon, CanonList>;
/// \param PND - The data to hash.
/// \returns The hash code of \p PND.
static hash_code encodePHINodeData(PHINodeData &PND) {
- return llvm::hash_combine(
- llvm::hash_value(PND.first.first), llvm::hash_value(PND.first.second),
- llvm::hash_combine_range(PND.second.begin(), PND.second.end()));
+ return llvm::hash_combine(llvm::hash_value(PND.first.first),
+ llvm::hash_value(PND.first.second),
+ llvm::hash_combine_range(PND.second));
}
/// Create a special GVN for PHINodes that will be used outside of
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 6233e8e2ee681..c0ae944ee82f2 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -165,9 +165,8 @@ struct llvm::GVNPass::Expression {
}
friend hash_code hash_value(const Expression &Value) {
- return hash_combine(
- Value.Opcode, Value.Ty,
- hash_combine_range(Value.VarArgs.begin(), Value.VarArgs.end()));
+ return hash_combine(Value.Opcode, Value.Ty,
+ hash_combine_range(Value.VarArgs));
}
};
diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp
index 6f88408abfdbc..2058df33ea331 100644
--- a/llvm/lib/Transforms/Scalar/GVNSink.cpp
+++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp
@@ -249,7 +249,7 @@ class ModelledPHI {
// Hash functor
unsigned hash() const {
// Is deterministic because Values are saved in a specific order.
- return (unsigned)hash_combine_range(Values.begin(), Values.end());
+ return (unsigned)hash_combine_range(Values);
}
bool operator==(const ModelledPHI &Other) const {
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index ed3709b74d60f..fd16593b2e874 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -1291,7 +1291,7 @@ struct UniquifierDenseMapInfo {
}
static unsigned getHashValue(const SmallVector<const SCEV *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<const SCEV *, 4> &LHS,
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index b07f3451420c7..c5c4968ef4dcc 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -553,8 +553,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
std::pair<std::pair<hash_code, DILocalVariable *>, DIExpression *>;
auto makeHash = [](auto *D) -> DbgIntrinsicHash {
auto VarLocOps = D->location_ops();
- return {{hash_combine_range(VarLocOps.begin(), VarLocOps.end()),
- D->getVariable()},
+ return {{hash_combine_range(VarLocOps), D->getVariable()},
D->getExpression()};
};
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 7f53aa7d4f73d..9e6ee58cafc79 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -7469,8 +7469,7 @@ template <> struct DenseMapInfo<const SwitchSuccWrapper *> {
for (PHINode &Phi : BB->phis())
PhiValsForBB.emplace_back((*SSW->PhiPredIVs)[&Phi][BB]);
- return hash_combine(
- BB, hash_combine_range(PhiValsForBB.begin(), PhiValsForBB.end()));
+ return hash_combine(BB, hash_combine_range(PhiValsForBB));
}
static bool isEqual(const SwitchSuccWrapper *LHS,
const SwitchSuccWrapper *RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 70cd201ab20a6..a56728226c039 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -5085,7 +5085,7 @@ class BoUpSLP {
}
static unsigned getHashValue(const OrdersType &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const OrdersType &LHS, const OrdersType &RHS) {
diff --git a/llvm/lib/Transforms/Vectorize/VPlanSLP.h b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
index 7f123689170ad..2b927b93e24cf 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanSLP.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanSLP.h
@@ -85,7 +85,7 @@ class VPlanSlp {
}
static unsigned getHashValue(const SmallVector<VPValue *, 4> &V) {
- return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
+ return static_cast<unsigned>(hash_combine_range(V));
}
static bool isEqual(const SmallVector<VPValue *, 4> &LHS,
diff --git a/llvm/tools/llvm-profgen/PerfReader.h b/llvm/tools/llvm-profgen/PerfReader.h
index a3bd7a0a6493e..4b3ac8f569755 100644
--- a/llvm/tools/llvm-profgen/PerfReader.h
+++ b/llvm/tools/llvm-profgen/PerfReader.h
@@ -386,9 +386,7 @@ struct AddrBasedCtxKey : public ContextKey {
return Context == Other->Context;
}
- void genHashCode() override {
- HashCode = hash_combine_range(Context.begin(), Context.end());
- }
+ void genHashCode() override { HashCode = hash_combine_range(Context); }
};
// The counter of branch samples for one function indexed by the branch,
|
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/29413 Here is the relevant piece of the build log for the reference |
No description provided.