diff --git a/llvm/include/llvm/ADT/FoldingSet.h b/llvm/include/llvm/ADT/FoldingSet.h index 28a84d9658838..f82eabd5044b2 100644 --- a/llvm/include/llvm/ADT/FoldingSet.h +++ b/llvm/include/llvm/ADT/FoldingSet.h @@ -16,7 +16,6 @@ #ifndef LLVM_ADT_FOLDINGSET_H #define LLVM_ADT_FOLDINGSET_H -#include "llvm/ADT/APInt.h" #include "llvm/ADT/Hashing.h" #include "llvm/ADT/STLForwardCompat.h" #include "llvm/ADT/SmallVector.h" @@ -355,13 +354,6 @@ class FoldingSetNodeID { AddInteger(unsigned(I)); AddInteger(unsigned(I >> 32)); } - void AddInteger(const APInt &Int) { - AddInteger(Int.getBitWidth()); - const auto *Parts = Int.getRawData(); - for (int i = 0, N = Int.getNumWords(); i < N; ++i) { - AddInteger(Parts[i]); - } - } void AddBoolean(bool B) { AddInteger(B ? 1U : 0U); } void AddString(StringRef String); diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h index 9a6427bbc3d55..58dc14588f41a 100644 --- a/llvm/lib/IR/AttributeImpl.h +++ b/llvm/lib/IR/AttributeImpl.h @@ -121,8 +121,8 @@ class AttributeImpl : public FoldingSetNode { static void Profile(FoldingSetNodeID &ID, Attribute::AttrKind Kind, const ConstantRange &CR) { ID.AddInteger(Kind); - ID.AddInteger(CR.getLower()); - ID.AddInteger(CR.getUpper()); + CR.getLower().Profile(ID); + CR.getUpper().Profile(ID); } }; diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp index 9c48a481de1ff..9f27f176b104e 100644 --- a/llvm/lib/IR/Attributes.cpp +++ b/llvm/lib/IR/Attributes.cpp @@ -173,8 +173,8 @@ Attribute Attribute::get(LLVMContext &Context, Attribute::AttrKind Kind, LLVMContextImpl *pImpl = Context.pImpl; FoldingSetNodeID ID; ID.AddInteger(Kind); - ID.AddInteger(CR.getLower()); - ID.AddInteger(CR.getUpper()); + CR.getLower().Profile(ID); + CR.getUpper().Profile(ID); void *InsertPoint; AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);