[PATCH] D40970: [ThinLTO] Remove unused (?) code from thinLTOInternalizeModule

Eugene Leviant via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 10:24:39 PST 2017


evgeny777 created this revision.
Herald added subscribers: inglorion, mehdi_amini.

I've found the piece of code running on ThinLTO internalization phase which seems useless to me.
Also no test seems to depend on it. I've run check-llvm after removal and it passes flawlessly.

It looks like undefined assembly symbols are first put to GlobalResolutions by lto::addModuleToGlobalRes and than 
thinLTOInternalizeAndPromoteInIndex is doing the job by setting the proper linkage in ModuleSummaryIndex.

If this code is needed can someone suggest how to write unit test for it?


Repository:
  rL LLVM

https://reviews.llvm.org/D40970

Files:
  lib/Transforms/IPO/FunctionImport.cpp


Index: lib/Transforms/IPO/FunctionImport.cpp
===================================================================
--- lib/Transforms/IPO/FunctionImport.cpp
+++ lib/Transforms/IPO/FunctionImport.cpp
@@ -642,23 +642,9 @@
 /// Run internalization on \p TheModule based on symmary analysis.
 void llvm::thinLTOInternalizeModule(Module &TheModule,
                                     const GVSummaryMapTy &DefinedGlobals) {
-  // Parse inline ASM and collect the list of symbols that are not defined in
-  // the current module.
-  StringSet<> AsmUndefinedRefs;
-  ModuleSymbolTable::CollectAsmSymbols(
-      TheModule,
-      [&AsmUndefinedRefs](StringRef Name, object::BasicSymbolRef::Flags Flags) {
-        if (Flags & object::BasicSymbolRef::SF_Undefined)
-          AsmUndefinedRefs.insert(Name);
-      });
-
   // Declare a callback for the internalize pass that will ask for every
   // candidate GlobalValue if it can be internalized or not.
   auto MustPreserveGV = [&](const GlobalValue &GV) -> bool {
-    // Can't be internalized if referenced in inline asm.
-    if (AsmUndefinedRefs.count(GV.getName()))
-      return true;
-
     // Lookup the linkage recorded in the summaries during global analysis.
     auto GS = DefinedGlobals.find(GV.getGUID());
     if (GS == DefinedGlobals.end()) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40970.125990.patch
Type: text/x-patch
Size: 1304 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171207/0ae04beb/attachment.bin>


More information about the llvm-commits mailing list