aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2017-11-10 23:37:39 +0000
committerTeresa Johnson <tejohnson@google.com>2017-11-10 23:37:39 +0000
commit140c1a0966ed45714f3ecc60474c7bf6eca341a3 (patch)
treed89a0475da83d5e9d9ae53af47f1f610a51caf90 /clang
parentbdb8db458917cd3d6a0b1d9dd67cb86748c052fb (diff)
downloadllvm-140c1a0966ed45714f3ecc60474c7bf6eca341a3.zip
llvm-140c1a0966ed45714f3ecc60474c7bf6eca341a3.tar.gz
llvm-140c1a0966ed45714f3ecc60474c7bf6eca341a3.tar.bz2
[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
Summary: The LTO Config field wasn't being set when invoking a ThinLTO backend via clang (i.e. for distributed builds). Reviewers: danielcdh Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D39923 llvm-svn: 317951
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp1
-rw-r--r--clang/test/CodeGen/thinlto-debug-pm.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 893967a..0df4463 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1073,6 +1073,7 @@ static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M,
initTargetOptions(Conf.Options, CGOpts, TOpts, LOpts, HeaderOpts);
Conf.SampleProfile = std::move(SampleProfile);
Conf.UseNewPM = CGOpts.ExperimentalNewPassManager;
+ Conf.DebugPassManager = CGOpts.DebugPassManager;
switch (Action) {
case Backend_EmitNothing:
Conf.PreCodeGenModuleHook = [](size_t Task, const Module &Mod) {
diff --git a/clang/test/CodeGen/thinlto-debug-pm.c b/clang/test/CodeGen/thinlto-debug-pm.c
new file mode 100644
index 0000000..9d9ab5e
--- /dev/null
+++ b/clang/test/CodeGen/thinlto-debug-pm.c
@@ -0,0 +1,9 @@
+// Test to ensure -fdebug-pass-manager works when invoking the
+// ThinLTO backend path with the new PM.
+// RUN: %clang -O2 %s -flto=thin -c -o %t.o
+// RUN: llvm-lto -thinlto -o %t %t.o
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s
+// CHECK: Running pass:
+
+void foo() {
+}