[lld] 15617cd - [ELF] Simplify --fortran-common. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 24 12:21:52 PST 2022


Author: Fangrui Song
Date: 2022-02-24T12:21:40-08:00
New Revision: 15617cdb55f93fedb2603702f777f5626c495c6a

URL: https://github.com/llvm/llvm-project/commit/15617cdb55f93fedb2603702f777f5626c495c6a
DIFF: https://github.com/llvm/llvm-project/commit/15617cdb55f93fedb2603702f777f5626c495c6a.diff

LOG: [ELF] Simplify --fortran-common. NFC

Added: 
    

Modified: 
    lld/ELF/Symbols.cpp

Removed: 
    


################################################################################
diff  --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index e361cce664c6..59b2950c5caf 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -653,15 +653,12 @@ void Symbol::resolveDefined(const Defined &other) {
 void Symbol::resolveLazy(const LazyObject &other) {
   // For common objects, we want to look for global or weak definitions that
   // should be extracted as the canonical definition instead.
-  if (isCommon() && elf::config->fortranCommon) {
-    if (auto *loSym = dyn_cast<LazyObject>(&other)) {
-      if (loSym->file->shouldExtractForCommon(getName())) {
-        backwardReferences.erase(this);
-        replace(other);
-        other.extract();
-        return;
-      }
-    }
+  if (LLVM_UNLIKELY(isCommon()) && elf::config->fortranCommon &&
+      other.file->shouldExtractForCommon(getName())) {
+    backwardReferences.erase(this);
+    replace(other);
+    other.extract();
+    return;
   }
 
   if (!isUndefined()) {


        


More information about the llvm-commits mailing list