[llvm] r295124 - Do not lookup a DenseMap twice using the same key.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 14 15:47:34 PST 2017
Author: ruiu
Date: Tue Feb 14 17:47:34 2017
New Revision: 295124
URL: http://llvm.org/viewvc/llvm-project?rev=295124&view=rev
Log:
Do not lookup a DenseMap twice using the same key.
Modified:
llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp?rev=295124&r1=295123&r2=295124&view=diff
==============================================================================
--- llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/WinCOFFObjectWriter.cpp Tue Feb 14 17:47:34 2017
@@ -230,13 +230,10 @@ COFFSymbol *WinCOFFObjectWriter::createS
}
COFFSymbol *WinCOFFObjectWriter::GetOrCreateCOFFSymbol(const MCSymbol *Symbol) {
- symbol_map::iterator i = SymbolMap.find(Symbol);
- if (i != SymbolMap.end())
- return i->second;
- COFFSymbol *RetSymbol =
- createCOFFEntity<COFFSymbol>(Symbol->getName(), Symbols);
- SymbolMap[Symbol] = RetSymbol;
- return RetSymbol;
+ COFFSymbol *&Ret = SymbolMap[Symbol];
+ if (!Ret)
+ Ret = createCOFFEntity<COFFSymbol>(Symbol->getName(), Symbols);
+ return Ret;
}
COFFSection *WinCOFFObjectWriter::createSection(StringRef Name) {
More information about the llvm-commits
mailing list