Resolver: Reduce number of SymbolTable::isDefined function calls.

If an undefined symbol is added to the symbol table by the previous
call of SymbolTable::add, SymbolTable::isDefined will always return
false for the same symbol.

llvm-svn: 231551
This commit is contained in:
Rui Ueyama 2015-03-07 03:55:32 +00:00
parent b3237de6e4
commit abd39f0549
1 changed files with 1 additions and 1 deletions

View File

@ -125,7 +125,7 @@ bool Resolver::doUndefinedAtom(const UndefinedAtom &atom) {
// If the undefined symbol has an alternative name, try to resolve the
// symbol with the name to give it a second chance. This feature is used
// for COFF "weak external" symbol.
if (!_symbolTable.isDefined(atom.name())) {
if (newUndefAdded || !_symbolTable.isDefined(atom.name())) {
if (const UndefinedAtom *fallbackAtom = atom.fallback()) {
doUndefinedAtom(*fallbackAtom);
_symbolTable.addReplacement(&atom, fallbackAtom);