[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
Wed Dec 5 13:45:19 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL348416: ThinLTO: Do not import debug info for imported global constants (authored by dblaikie, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D55309?vs=176755&id=176875#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55309/new/

https://reviews.llvm.org/D55309

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


Index: llvm/trunk/test/ThinLTO/X86/index-const-prop.ll
===================================================================
--- llvm/trunk/test/ThinLTO/X86/index-const-prop.ll
+++ llvm/trunk/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: llvm/trunk/test/ThinLTO/X86/index-const-prop2.ll
===================================================================
--- llvm/trunk/test/ThinLTO/X86/index-const-prop2.ll
+++ llvm/trunk/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: llvm/trunk/lib/Linker/IRMover.cpp
===================================================================
--- llvm/trunk/lib/Linker/IRMover.cpp
+++ llvm/trunk/lib/Linker/IRMover.cpp
@@ -1062,6 +1062,16 @@
     ValueMap.MD()[CU->getRawEnumTypes()].reset(nullptr);
     ValueMap.MD()[CU->getRawMacros()].reset(nullptr);
     ValueMap.MD()[CU->getRawRetainedTypes()].reset(nullptr);
+    // The original definition (or at least its debug info - if the variable is
+    // internalized an optimized away) will remain in the source module, so
+    // there's no need to import them.
+    // If LLVM ever does more advanced optimizations on global variables
+    // (removing/localizing write operations, for instance) that can track
+    // through debug info, this decision may need to be revisited - but do so
+    // with care when it comes to debug info size. Emitting small CUs containing
+    // only a few imported entities into every destination module may be very
+    // size inefficient.
+    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.176875.patch
Type: text/x-patch
Size: 2343 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181205/a80de67c/attachment.bin>


More information about the llvm-commits mailing list