Skip to content

Commit d9d656e

Browse files
committed
[ELF] resolve LazySymbol: remove a branch in the fast path
1 parent 0a44b24 commit d9d656e

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

lld/ELF/Symbols.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -619,20 +619,18 @@ void Symbol::resolve(Ctx &ctx, const LazySymbol &other) {
619619
return;
620620
}
621621

622-
// For common objects, we want to look for global or weak definitions that
623-
// should be extracted as the canonical definition instead.
624-
if (LLVM_UNLIKELY(isCommon()) && ctx.arg.fortranCommon &&
625-
other.file->shouldExtractForCommon(getName())) {
626-
ctx.backwardReferences.erase(this);
627-
other.overwrite(*this);
628-
other.extract(ctx);
629-
return;
630-
}
631-
632-
if (!isUndefined()) {
633-
// See the comment in resolveUndefined().
634-
if (isDefined())
622+
if (LLVM_UNLIKELY(!isUndefined())) {
623+
// See the comment in resolve(Ctx &, const Undefined &).
624+
if (isDefined()) {
625+
ctx.backwardReferences.erase(this);
626+
} else if (isCommon() && ctx.arg.fortranCommon &&
627+
other.file->shouldExtractForCommon(getName())) {
628+
// For common objects, we want to look for global or weak definitions that
629+
// should be extracted as the canonical definition instead.
635630
ctx.backwardReferences.erase(this);
631+
other.overwrite(*this);
632+
other.extract(ctx);
633+
}
636634
return;
637635
}
638636

0 commit comments

Comments
 (0)