[lld] [lld] Merge equivalent symbols found during ICF (PR #134342)
    Fangrui Song via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Apr 16 09:13:54 PDT 2025
    
    
  
================
@@ -561,11 +598,25 @@ template <class ELFT> void ICF<ELFT>::run() {
           d->folded = true;
         }
   };
-  for (Symbol *sym : ctx.symtab->getSymbols())
+  for (Symbol *sym : ctx.symtab->getSymbols()) {
     fold(sym);
+    auto it = symbolEquivalence.findLeader(sym);
+    if (it != symbolEquivalence.member_end() && *it != sym) {
+      print() << "Redirecting " << sym->getName() << " to " << (*it)->getName();
----------------
MaskRay wrote:
Use lower-case messages (convention; we follow https://llvm.org/docs/CodingStandards.html#error-and-warning-messages)
In new messages, we quote symbol names like `'sym'`
https://github.com/llvm/llvm-project/pull/134342
    
    
More information about the llvm-commits
mailing list