[llvm] 534f6ed - [MC,MachO] Remove unneeded condition from isSymbolRefDifferenceFullyResolvedImpl

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 29 15:37:41 PDT 2024


Author: Fangrui Song
Date: 2024-06-29T15:37:37-07:00
New Revision: 534f6ed6237ddf8b966b66c7b0a491fff5b33afb

URL: https://github.com/llvm/llvm-project/commit/534f6ed6237ddf8b966b66c7b0a491fff5b33afb
DIFF: https://github.com/llvm/llvm-project/commit/534f6ed6237ddf8b966b66c7b0a491fff5b33afb.diff

LOG: [MC,MachO] Remove unneeded condition from isSymbolRefDifferenceFullyResolvedImpl

The code change from 91ea511436232c3b240d5f0a67a4639d7149dfdc (2011) can
now be removed.

Added: 
    

Modified: 
    llvm/lib/MC/MachObjectWriter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp
index de8bde4211b49..b98ca3cc53fc3 100644
--- a/llvm/lib/MC/MachObjectWriter.cpp
+++ b/llvm/lib/MC/MachObjectWriter.cpp
@@ -716,18 +716,8 @@ bool MachObjectWriter::isSymbolRefDifferenceFullyResolvedImpl(
   if (&SecA != &SecB)
     return false;
 
-  const MCFragment *FA = SA.getFragment();
-
-  // Bail if the symbol has no fragment.
-  if (!FA)
-    return false;
-
   // If the atoms are the same, they are guaranteed to have the same address.
-  if (FA->getAtom() == FB.getAtom())
-    return true;
-
-  // Otherwise, we can't prove this is fully resolved.
-  return false;
+  return SA.getFragment()->getAtom() == FB.getAtom();
 }
 
 static MachO::LoadCommandType getLCFromMCVM(MCVersionMinType Type) {


        


More information about the llvm-commits mailing list