[llvm] Move a lot of symbol code to use the symbol string pool (PR #115796)

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 22:14:59 PST 2024


================
@@ -106,14 +106,14 @@ Symbol &createELFGOTHeader(LinkGraph &G,
   Symbol *TOCSymbol = nullptr;
 
   for (Symbol *Sym : G.defined_symbols())
-    if (LLVM_UNLIKELY(Sym->getName() == ELFTOCSymbolName)) {
+    if (LLVM_UNLIKELY(Sym->hasName() && *Sym->getName() == ELFTOCSymbolName)) {
----------------
lhames wrote:

If `ELFTOCSymbolName` is guaranteed to be non-null (which I believe it is) then this could just be `Sym->getName() == ELFTOCSymbolName`.

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


More information about the llvm-commits mailing list