summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2017-11-13 15:38:33 +0000
committerTeresa Johnson <tejohnson@google.com>2017-11-13 15:38:33 +0000
commit4cd016ab7c9bbcf8436015bbbefdbebae010d02a (patch)
tree79dd5a0a15ac72ff52ef9f3dbb9a45c8f7fc922b
parent4c679e14354480e7a0ad24f84133b47b3b666d51 (diff)
downloadbcm5719-llvm-4cd016ab7c9bbcf8436015bbbefdbebae010d02a.tar.gz
bcm5719-llvm-4cd016ab7c9bbcf8436015bbbefdbebae010d02a.zip
[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
Recommit of r317951 and r317951 along with what I believe should fix the remaining buildbot failures - the target triple should be specified for both the ThinLTO pre-thinlink compile and backend (post-thinlink) compile to ensure it is consistent. Original description: The LTO Config field wasn't being set when invoking a ThinLTO backend via clang (i.e. for distributed builds). llvm-svn: 318042
-rw-r--r--clang/lib/CodeGen/BackendUtil.cpp1
-rw-r--r--clang/test/CodeGen/thinlto-debug-pm.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 893967a9d66..0df446327a8 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 00000000000..2accde1f362
--- /dev/null
+++ b/clang/test/CodeGen/thinlto-debug-pm.c
@@ -0,0 +1,10 @@
+// Test to ensure -fdebug-pass-manager works when invoking the
+// ThinLTO backend path with the new PM.
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 -o %t.o -flto=thin -fexperimental-new-pass-manager -triple x86_64-unknown-linux-gnu -emit-llvm-bc %s
+// 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() {
+}
OpenPOWER on IntegriCloud