ThinLTOBitcodeWriter: Strip debug info from merged module.

This module will contain nothing but vtable definitions and (soon)
available_externally function definitions, so there is no point in keeping
debug info in the module.

Differential Revision: https://reviews.llvm.org/D28913

llvm-svn: 294511
This commit is contained in:
Peter Collingbourne 2017-02-08 20:44:00 +00:00
parent 8a450fb140
commit 28ffd3261f
2 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "llvm/Analysis/TypeMetadataUtils.h"
#include "llvm/Bitcode/BitcodeWriter.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/PassManager.h"
@ -261,6 +262,7 @@ void splitAndWriteThinLTOBitcode(raw_ostream &OS, Module &M) {
ValueToValueMapTy VMap;
std::unique_ptr<Module> MergedM(CloneModule(&M, VMap, IsInMergedM));
StripDebugInfo(*MergedM);
filterModule(&M, [&](const GlobalValue *GV) { return !IsInMergedM(GV); });

View File

@ -26,3 +26,10 @@ define i8* @f() {
; M1: !0 = !{i32 0, !"typeid"}
!0 = !{i32 0, !"typeid"}
; M0: !llvm.dbg.cu
; M1-NOT: !llvm.dbg.cu
!llvm.dbg.cu = !{}
!1 = !{i32 2, !"Debug Info Version", i32 3}
!llvm.module.flags = !{!1}