[PATCH] D55309: ThinLTO: Do not import debug info for imported global constants

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 4 18:49:26 PST 2018


dblaikie created this revision.
dblaikie added reviewers: tejohnson, evgeny777.
Herald added subscribers: llvm-commits, arphaman, dexonsmith, steven_wu, JDevlieghere, eraman, inglorion, aprantl.

It looks like this isn't necessary (in any tests I've done, it results
in the global being described with no location or value in the imported
side - while it's still fully described in the place it's imported from)
& results in significant/pathological debug info growth to home these
location-less global variable descriptions on the import side.

This is a rather pressing/important issue to address - this regressed
executable size for one example I'm looking at by 15%, object size is probably
similar though I haven't measured it, and a 22x increase in the number of CUs
in the cu_index in split DWARF DWP files, creating a similarly large regression
in the time it takes llvm-symbolizer to run on such binaries.


Repository:
  rL LLVM

https://reviews.llvm.org/D55309

Files:
  lib/Linker/IRMover.cpp
  test/ThinLTO/X86/index-const-prop.ll
  test/ThinLTO/X86/index-const-prop2.ll


Index: test/ThinLTO/X86/index-const-prop2.ll
===================================================================
--- test/ThinLTO/X86/index-const-prop2.ll
+++ test/ThinLTO/X86/index-const-prop2.ll
@@ -34,7 +34,7 @@
 
 ; IMPORT:       @gFoo.llvm.0 = internal unnamed_addr global i32 1, align 4
 ; IMPORT-NEXT:  @gBar = internal local_unnamed_addr global i32 2, align 4
-; IMPORT:       !DICompileUnit({{.*}}, globals: !{{[0-9]+}})
+; IMPORT:       !DICompileUnit({{.*}})
 
 ; CODEGEN:        i32 @main()
 ; CODEGEN-NEXT:     ret i32 3
Index: test/ThinLTO/X86/index-const-prop.ll
===================================================================
--- test/ThinLTO/X86/index-const-prop.ll
+++ test/ThinLTO/X86/index-const-prop.ll
@@ -21,7 +21,7 @@
 
 ; IMPORT: @gFoo.llvm.0 = internal unnamed_addr global i32 1, align 4, !dbg !0
 ; IMPORT-NEXT: @gBar = internal local_unnamed_addr global i32 2, align 4, !dbg !5
-; IMPORT: !DICompileUnit({{.*}}, globals: !{{[0-9]+}})
+; IMPORT: !DICompileUnit({{.*}})
 
 ; OPTIMIZE:        define i32 @main
 ; OPTIMIZE-NEXT:     ret i32 3
Index: lib/Linker/IRMover.cpp
===================================================================
--- lib/Linker/IRMover.cpp
+++ lib/Linker/IRMover.cpp
@@ -1062,6 +1062,7 @@
     ValueMap.MD()[CU->getRawEnumTypes()].reset(nullptr);
     ValueMap.MD()[CU->getRawMacros()].reset(nullptr);
     ValueMap.MD()[CU->getRawRetainedTypes()].reset(nullptr);
+    ValueMap.MD()[CU->getRawGlobalVariables()].reset(nullptr);
 
     // Imported entities only need to be mapped in if they have local
     // scope, as those might correspond to an imported entity inside a


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55309.176755.patch
Type: text/x-patch
Size: 1629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181205/55cf09e9/attachment.bin>


More information about the llvm-commits mailing list