summaryrefslogtreecommitdiffstats
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
commit40fa5afece4ac6e3aebe19ed70058a0fdafcffa6 (patch)
treea2282c91bd9a51b81cb0cb4188d9b4e1369541bc
parentc4d9d53eb342759594b439f1fedaec9ec44447b9 (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@317951 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/BackendUtil.cpp1
-rw-r--r--test/CodeGen/thinlto-debug-pm.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/CodeGen/BackendUtil.cpp b/lib/CodeGen/BackendUtil.cpp
index 893967a9d6..0df446327a 100644
--- a/lib/CodeGen/BackendUtil.cpp
+++ b/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/test/CodeGen/thinlto-debug-pm.c b/test/CodeGen/thinlto-debug-pm.c
new file mode 100644
index 0000000000..9d9ab5e39d
--- /dev/null
+++ b/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() {
+}