From: Peter Collingbourne Date: Fri, 20 Jan 2017 22:39:16 +0000 (+0000) Subject: IRGen: Start using the WriteThinLTOBitcode pass. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f16ac1473e5e7df1fce4210716851dea9f58a1e;p=platform%2Fupstream%2Fllvm.git IRGen: Start using the WriteThinLTOBitcode pass. This is the final change necessary to support CFI with ThinLTO. Differential Revision: https://reviews.llvm.org/D28843 llvm-svn: 292662 --- diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index bac1e89..4fdffde 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -689,9 +689,11 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action, break; case Backend_EmitBC: - PerModulePasses.add(createBitcodeWriterPass( - *OS, CodeGenOpts.EmitLLVMUseLists, CodeGenOpts.EmitSummaryIndex, - CodeGenOpts.EmitSummaryIndex)); + if (CodeGenOpts.EmitSummaryIndex) + PerModulePasses.add(createWriteThinLTOBitcodePass(*OS)); + else + PerModulePasses.add( + createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists)); break; case Backend_EmitLL: diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt index e337199..6e6acb7 100644 --- a/clang/test/CMakeLists.txt +++ b/clang/test/CMakeLists.txt @@ -80,6 +80,7 @@ if( NOT CLANG_BUILT_STANDALONE ) llc llvm-bcanalyzer llvm-dis + llvm-modextract llvm-nm llvm-objdump llvm-profdata diff --git a/clang/test/CodeGenCXX/type-metadata-thinlto.cpp b/clang/test/CodeGenCXX/type-metadata-thinlto.cpp new file mode 100644 index 0000000..2a586fc --- /dev/null +++ b/clang/test/CodeGenCXX/type-metadata-thinlto.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -flto=thin -flto-unit -triple x86_64-unknown-linux -fvisibility hidden -emit-llvm-bc -o %t %s +// RUN: llvm-modextract -o - -n 1 %t | llvm-dis | FileCheck %s + +// CHECK: @_ZTV1A = linkonce_odr +class A { + virtual void f() {} +}; + +A *f() { + return new A; +}