[ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds
authorTeresa Johnson <tejohnson@google.com>
Tue, 17 Apr 2018 16:39:25 +0000 (16:39 +0000)
committerTeresa Johnson <tejohnson@google.com>
Tue, 17 Apr 2018 16:39:25 +0000 (16:39 +0000)
commit9e4321c12d6a097742419ea4e2c458e1f21734bf
tree804284227dca56f34a5f1ed462c66ea213138e12
parentc7ff2e9a4fd1736c986eb4fc0cc2c361ea5878f2
[ThinLTO] Pass -save-temps to LTO backend for distributed ThinLTO builds

Summary:
The clang driver option -save-temps was not passed to the LTO config,
so when invoking the ThinLTO backends via clang during distributed
builds there was no way to get LTO to save temp files.

Getting this to work with ThinLTO distributed builds also required
changing the driver to avoid a separate compile step to emit unoptimized
bitcode when the input was already bitcode under -save-temps. Not only is
this unnecessary in general, it is problematic for ThinLTO backends since
the temporary bitcode file to the backend would not match the module path
in the combined index, leading to incorrect ThinLTO backend index-based
optimizations.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

llvm-svn: 330194
clang/include/clang/Driver/Options.td
clang/include/clang/Frontend/CodeGenOptions.h
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/Driver/Driver.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/thinlto_backend.ll
clang/test/Driver/thinlto_backend.c