Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion llvm/include/llvm/ADT/ArrayRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ADT/Hashing.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
36 changes: 17 additions & 19 deletions llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion llvm/include/llvm/ProfileData/SampleProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
3 changes: 1 addition & 2 deletions llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
};

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MIRVRegNamerUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/MachineInstr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/CodeGen/RegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/ExecutionEngine/Orc/IRPartitionLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down
14 changes: 4 additions & 10 deletions llvm/lib/IR/ConstantsContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/IR/LLVMContextImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 7 additions & 15 deletions llvm/lib/IR/LLVMContextImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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> {
Expand Down Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Linker/IRMover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Support/StringRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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() &&
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Transforms/IPO/IROutliner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Transforms/Scalar/GVN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
};

Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Scalar/GVNSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()};
};

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Vectorize/VPlanSLP.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions llvm/tools/llvm-profgen/PerfReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading