[ThinLTO] Pass down opt level to LTO backend and handle -O0 LTO in new PM
authorTeresa Johnson <tejohnson@google.com>
Tue, 23 Apr 2019 18:56:19 +0000 (18:56 +0000)
committerTeresa Johnson <tejohnson@google.com>
Tue, 23 Apr 2019 18:56:19 +0000 (18:56 +0000)
commit867bc3951bff977f930ca2451e9d1d3548587522
treeb1bba0daf98be6c9cb2b85dd9e9fa1070fe903a1
parent6967da8ffafe094507b153a93c607b95f2ab22a6
[ThinLTO] Pass down opt level to LTO backend and handle -O0 LTO in new PM

Summary:
The opt level was not being passed down to the ThinLTO backend when
invoked via clang (for distributed ThinLTO).

This exposed an issue where the new PM was asserting if the Thin or
regular LTO backend pipelines were invoked with -O0 (not a new issue,
could be provoked by invoking in-process *LTO backends via linker using
new PM and -O0). Fix this similar to the old PM where -O0 only does the
necessary lowering of type metadata (WPD and LowerTypeTest passes) and
then quits, rather than asserting.

Reviewers: xur

Subscribers: mehdi_amini, inglorion, eraman, hiraditya, steven_wu, dexonsmith, cfe-commits, llvm-commits, pcc

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D61022

llvm-svn: 359025
clang/lib/CodeGen/BackendUtil.cpp
clang/test/CodeGen/thinlto-debug-pm.c
clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll
llvm/lib/Passes/PassBuilder.cpp
llvm/test/tools/gold/X86/opt-level.ll