Do not lookup a DenseMap twice using the same key.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295124 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rui Ueyama 2017-02-14 23:47:34 +00:00
parent d5265b3065
commit 7c1b5b039c

View File

@ -230,13 +230,10 @@ COFFSymbol *WinCOFFObjectWriter::createSymbol(StringRef Name) {
} }
COFFSymbol *WinCOFFObjectWriter::GetOrCreateCOFFSymbol(const MCSymbol *Symbol) { COFFSymbol *WinCOFFObjectWriter::GetOrCreateCOFFSymbol(const MCSymbol *Symbol) {
symbol_map::iterator i = SymbolMap.find(Symbol); COFFSymbol *&Ret = SymbolMap[Symbol];
if (i != SymbolMap.end()) if (!Ret)
return i->second; Ret = createCOFFEntity<COFFSymbol>(Symbol->getName(), Symbols);
COFFSymbol *RetSymbol = return Ret;
createCOFFEntity<COFFSymbol>(Symbol->getName(), Symbols);
SymbolMap[Symbol] = RetSymbol;
return RetSymbol;
} }
COFFSection *WinCOFFObjectWriter::createSection(StringRef Name) { COFFSection *WinCOFFObjectWriter::createSection(StringRef Name) {