[llvm] 97866b8 - [ThinLTO][Legacy] Fix StringRef assertion from ThinLTO bots

Steven Wu via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 12:31:24 PDT 2020


Author: Steven Wu
Date: 2020-09-04T12:30:09-07:00
New Revision: 97866b8de81ce71cf9ae9e50feb450335b0537a0

URL: https://github.com/llvm/llvm-project/commit/97866b8de81ce71cf9ae9e50feb450335b0537a0
DIFF: https://github.com/llvm/llvm-project/commit/97866b8de81ce71cf9ae9e50feb450335b0537a0.diff

LOG: [ThinLTO][Legacy] Fix StringRef assertion from ThinLTO bots

This is a presumed fix for FireFox thinLTO bot fix which hits assertion
failure for invalid index when access StringRef. Techinically, `IRName`
in the symtab should not be empty string for the entries we cared about
but this will help to fix the bot before more information can be
provided. Otherwise, NFCI.

Added: 
    

Modified: 
    llvm/lib/LTO/ThinLTOCodeGenerator.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 4adc9a22a7b2..14dae848b362 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -276,7 +276,7 @@ static void computeGUIDPreservedSymbols(const lto::InputFile &File,
   // Iterate the symbols in the input file and if the input has preserved symbol
   // compute the GUID for the symbol.
   for (const auto &Sym : File.symbols()) {
-    if (PreservedSymbols.count(Sym.getName()))
+    if (PreservedSymbols.count(Sym.getName()) && !Sym.getIRName().empty())
       GUIDs.insert(GlobalValue::getGUID(GlobalValue::getGlobalIdentifier(
           Sym.getIRName(), GlobalValue::ExternalLinkage, "")));
   }


        


More information about the llvm-commits mailing list