diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-01-03 00:29:27 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-01-03 00:29:27 +0000 |
| commit | b18b0b99c6c5a1d8ddfd3bcaf1015c1237840ada (patch) | |
| tree | 46f605d85f2be6e3f190992f826782a717acb659 | |
| parent | a7f7ac7072c6501191a0415e752af790a019c31d (diff) | |
| download | bcm5719-llvm-b18b0b99c6c5a1d8ddfd3bcaf1015c1237840ada.tar.gz bcm5719-llvm-b18b0b99c6c5a1d8ddfd3bcaf1015c1237840ada.zip | |
Don't create a new ParamAttrsList (which copies the vector) just to
get a profile.
llvm-svn: 45524
| -rw-r--r-- | llvm/include/llvm/ParameterAttributes.h | 5 | ||||
| -rw-r--r-- | llvm/lib/VMCore/ParameterAttributes.cpp | 12 |
2 files changed, 10 insertions, 7 deletions
diff --git a/llvm/include/llvm/ParameterAttributes.h b/llvm/include/llvm/ParameterAttributes.h index 05c3ebe9397..2b557bd684b 100644 --- a/llvm/include/llvm/ParameterAttributes.h +++ b/llvm/include/llvm/ParameterAttributes.h @@ -266,7 +266,10 @@ class ParamAttrsList : public FoldingSetNode { /// @name Implementation Details /// @{ public: - void Profile(FoldingSetNodeID &ID) const; + void Profile(FoldingSetNodeID &ID) const { + Profile(ID, attrs); + } + static void Profile(FoldingSetNodeID &ID, const ParamAttrsVector &Attrs); void dump() const; /// @} diff --git a/llvm/lib/VMCore/ParameterAttributes.cpp b/llvm/lib/VMCore/ParameterAttributes.cpp index aaf80cd7658..b6c29922a61 100644 --- a/llvm/lib/VMCore/ParameterAttributes.cpp +++ b/llvm/lib/VMCore/ParameterAttributes.cpp @@ -106,9 +106,10 @@ ParamAttrsList::areCompatible(const ParamAttrsList *A, const ParamAttrsList *B){ return true; } -void ParamAttrsList::Profile(FoldingSetNodeID &ID) const { - for (unsigned i = 0; i < attrs.size(); ++i) - ID.AddInteger(unsigned(attrs[i].attrs) << 16 | unsigned(attrs[i].index)); +void ParamAttrsList::Profile(FoldingSetNodeID &ID, + const ParamAttrsVector &Attrs) { + for (unsigned i = 0; i < Attrs.size(); ++i) + ID.AddInteger(unsigned(Attrs[i].attrs) << 16 | unsigned(Attrs[i].index)); } const ParamAttrsList * @@ -127,11 +128,10 @@ ParamAttrsList::get(const ParamAttrsVector &attrVec) { #endif // Otherwise, build a key to look up the existing attributes. - ParamAttrsList key(attrVec); FoldingSetNodeID ID; - key.Profile(ID); + ParamAttrsList::Profile(ID, attrVec); void *InsertPos; - ParamAttrsList* PAL = ParamAttrsLists->FindNodeOrInsertPos(ID, InsertPos); + ParamAttrsList *PAL = ParamAttrsLists->FindNodeOrInsertPos(ID, InsertPos); // If we didn't find any existing attributes of the same shape then // create a new one and insert it. |

