Skip to content
This repository was archived by the owner on Nov 1, 2021. It is now read-only.

Commit c484872

Browse files
committed
IRGen: Start using the WriteThinLTOBitcode pass.
This is the final change necessary to support CFI with ThinLTO. Differential Revision: https://reviews.llvm.org/D28843 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@292662 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent daee7ce commit c484872

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

lib/CodeGen/BackendUtil.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,11 @@ void EmitAssemblyHelper::EmitAssembly(BackendAction Action,
689689
break;
690690

691691
case Backend_EmitBC:
692-
PerModulePasses.add(createBitcodeWriterPass(
693-
*OS, CodeGenOpts.EmitLLVMUseLists, CodeGenOpts.EmitSummaryIndex,
694-
CodeGenOpts.EmitSummaryIndex));
692+
if (CodeGenOpts.EmitSummaryIndex)
693+
PerModulePasses.add(createWriteThinLTOBitcodePass(*OS));
694+
else
695+
PerModulePasses.add(
696+
createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists));
695697
break;
696698

697699
case Backend_EmitLL:

test/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ if( NOT CLANG_BUILT_STANDALONE )
8080
llc
8181
llvm-bcanalyzer
8282
llvm-dis
83+
llvm-modextract
8384
llvm-nm
8485
llvm-objdump
8586
llvm-profdata
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %clang_cc1 -flto=thin -flto-unit -triple x86_64-unknown-linux -fvisibility hidden -emit-llvm-bc -o %t %s
2+
// RUN: llvm-modextract -o - -n 1 %t | llvm-dis | FileCheck %s
3+
4+
// CHECK: @_ZTV1A = linkonce_odr
5+
class A {
6+
virtual void f() {}
7+
};
8+
9+
A *f() {
10+
return new A;
11+
}

0 commit comments

Comments
 (0)