[llvm-commits] [llvm] r45524 - in /llvm/trunk: include/llvm/ParameterAttributes.h lib/VMCore/ParameterAttributes.cpp
Chris Lattner
sabre at nondot.org
Wed Jan 2 16:29:28 PST 2008
Author: lattner
Date: Wed Jan 2 18:29:27 2008
New Revision: 45524
URL: http://llvm.org/viewvc/llvm-project?rev=45524&view=rev
Log:
Don't create a new ParamAttrsList (which copies the vector) just to
get a profile.
Modified:
llvm/trunk/include/llvm/ParameterAttributes.h
llvm/trunk/lib/VMCore/ParameterAttributes.cpp
Modified: llvm/trunk/include/llvm/ParameterAttributes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ParameterAttributes.h?rev=45524&r1=45523&r2=45524&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ParameterAttributes.h (original)
+++ llvm/trunk/include/llvm/ParameterAttributes.h Wed Jan 2 18:29:27 2008
@@ -266,7 +266,10 @@
/// @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;
/// @}
Modified: llvm/trunk/lib/VMCore/ParameterAttributes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ParameterAttributes.cpp?rev=45524&r1=45523&r2=45524&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ParameterAttributes.cpp (original)
+++ llvm/trunk/lib/VMCore/ParameterAttributes.cpp Wed Jan 2 18:29:27 2008
@@ -106,9 +106,10 @@
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 @@
#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.
More information about the llvm-commits
mailing list