Skip to content

Commit

Permalink
[ThinLTO] Handle -fdebug-pass-manager for backend invocations via clang
Browse files Browse the repository at this point in the history
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
  • Loading branch information
teresajohnson committed Nov 10, 2017
1 parent bdb8db4 commit 140c1a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions clang/lib/CodeGen/BackendUtil.cpp
Expand Up @@ -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) {
Expand Down
9 changes: 9 additions & 0 deletions 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() {
}

0 comments on commit 140c1a0

Please sign in to comment.