[lld] [lld][ELF] Merge equivalent symbols found during ICF (PR #139493)

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 10 16:25:08 PDT 2025


================
@@ -286,9 +313,14 @@ bool ICF<ELFT>::constantEq(const InputSection *secA, Relocs<RelTy> ra,
     // Relocations referring to InputSections are constant-equal if their
     // section offsets are equal.
     if (isa<InputSection>(da->section)) {
-      if (da->value + addA == db->value + addB)
+      if (da->value + addA == db->value + addB) {
----------------
rnk wrote:

If it helps break disagreement, I lean towards @MaskRay 's suggestion to use `da->value == db->value && addA == addB` as the condition (same value, same addend). Maybe it misses something, but it's conceptually simpler even if it misses some case.

https://github.com/llvm/llvm-project/pull/139493


More information about the llvm-commits mailing list