From: Duncan Sands Date: Tue, 11 Sep 2007 14:40:04 +0000 (+0000) Subject: Two ParamAttrsVectors which differ by a permutation X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=d50dc73b8934e751dfe21412c020c4e687e9ae17;p=oota-llvm.git Two ParamAttrsVectors which differ by a permutation of their elements do not yield the same ParamAttrsList, though they should. On the other hand, everyone seems to pass such vectors with elements ordered by increasing index, so rather than sorting the elements simply assert that the elements are ordered in this way. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41845 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp index a4bc69b4721..3582b321504 100644 --- a/lib/VMCore/Function.cpp +++ b/lib/VMCore/Function.cpp @@ -124,6 +124,10 @@ static ManagedStatic > ParamAttrsLists; ParamAttrsList * ParamAttrsList::get(const ParamAttrsVector &attrVec) { assert(!attrVec.empty() && "Illegal to create empty ParamAttrsList"); +#ifndef NDEBUG + for (unsigned i = 1, e = attrVec.size(); i < e; ++i) + assert(attrVec[i-1].index < attrVec[i].index && "Misordered ParamAttrsList!"); +#endif ParamAttrsList key(attrVec); FoldingSetNodeID ID; key.Profile(ID);