[cfe-commits] r90568 - /cfe/trunk/lib/CodeGen/CGVtable.cpp
Anders Carlsson
andersca at mac.com
Fri Dec 4 07:49:03 PST 2009
Author: andersca
Date: Fri Dec 4 09:49:02 2009
New Revision: 90568
URL: http://llvm.org/viewvc/llvm-project?rev=90568&view=rev
Log:
Change getIndex to return false if the index wasn't found. Avoids an extra hash lookup.
Modified:
cfe/trunk/lib/CodeGen/CGVtable.cpp
Modified: cfe/trunk/lib/CodeGen/CGVtable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVtable.cpp?rev=90568&r1=90567&r2=90568&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVtable.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVtable.cpp Fri Dec 4 09:49:02 2009
@@ -91,15 +91,17 @@
MethodToIndexMap[GD] = Index;
}
- bool hasIndex(GlobalDecl GD) const {
- return MethodToIndexMap.count(GD);
- }
+ /// getIndex - Gives the index of a passed in GlobalDecl. Returns false if
+ /// the index couldn't be found.
+ uint64_t getIndex(GlobalDecl GD, uint64_t &Index) const {
+ llvm::DenseMap<GlobalDecl, uint64_t>::const_iterator i
+ = MethodToIndexMap.find(GD);
- /// getIndex - Returns the index of the given method.
- uint64_t getIndex(GlobalDecl GD) const {
- assert(MethodToIndexMap.count(GD) && "Did not find method!");
+ if (i == MethodToIndexMap.end())
+ return false;
- return MethodToIndexMap.lookup(GD);
+ Index = i->second;
+ return true;
}
MethodsVectorTy::size_type size() const {
@@ -741,11 +743,10 @@
OGD = OMD;
// FIXME: Explain why this is necessary!
- if (!Methods.hasIndex(OGD))
+ uint64_t Index;
+ if (!Methods.getIndex(OGD, Index))
continue;
- uint64_t Index = Methods.getIndex(OGD);
-
QualType ReturnType =
MD->getType()->getAs<FunctionType>()->getResultType();
QualType OverriddenReturnType =
More information about the cfe-commits
mailing list