summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2015-12-07 19:21:34 +0000
committerTeresa Johnson <tejohnson@google.com>2015-12-07 19:21:34 +0000
commitaff223278c3770ba11c98bc33b53e0ea6ff675ae (patch)
tree0e9ed66ab2ea48c517b481670c305eef7af21807 /clang/lib/Driver
parent5fcbdb717c994ca4215003e8ba349b6f0943e80b (diff)
downloadbcm5719-llvm-aff223278c3770ba11c98bc33b53e0ea6ff675ae.tar.gz
bcm5719-llvm-aff223278c3770ba11c98bc33b53e0ea6ff675ae.zip
[ThinLTO] Option to invoke ThinLTO backend passes and importing
Summary: Adds new option -fthinlto-index=<file> to invoke the LTO pipeline along with function importing via clang using the supplied function summary index file. This supports invoking the parallel ThinLTO backend processes in a distributed build environment via clang. Additionally, this causes the module linker to be invoked on the bitcode file being compiled to perform any necessary promotion and renaming of locals that are exported via the function summary index file. Add a couple tests that confirm we get expected errors when we try to use the new option on a file that isn't bitcode, or specify an invalid index file. The tests also confirm that we trigger the expected function import pass. Depends on D15024 Reviewers: joker.eph, dexonsmith Subscribers: joker.eph, davidxl, cfe-commits Differential Revision: http://reviews.llvm.org/D15025 llvm-svn: 254927
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/Tools.cpp7
-rw-r--r--clang/lib/Driver/Types.cpp13
2 files changed, 20 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 2015e3b821d..7025314c691 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -3419,6 +3419,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddLastArg(CmdArgs, options::OPT_flto, options::OPT_flto_EQ);
}
+ if (const Arg *A = Args.getLastArg(options::OPT_fthinlto_index_EQ)) {
+ if (!types::isLLVMIR(Input.getType()))
+ D.Diag(diag::err_drv_argument_only_allowed_with) << A->getAsString(Args)
+ << "-x ir";
+ Args.AddLastArg(CmdArgs, options::OPT_fthinlto_index_EQ);
+ }
+
// We normally speed up the clang process a bit by skipping destructors at
// exit, but when we're generating diagnostics we can rely on some of the
// cleanup.
diff --git a/clang/lib/Driver/Types.cpp b/clang/lib/Driver/Types.cpp
index 2085b012429..c29ce9462a0 100644
--- a/clang/lib/Driver/Types.cpp
+++ b/clang/lib/Driver/Types.cpp
@@ -128,6 +128,19 @@ bool types::isCXX(ID Id) {
}
}
+bool types::isLLVMIR(ID Id) {
+ switch (Id) {
+ default:
+ return false;
+
+ case TY_LLVM_IR:
+ case TY_LLVM_BC:
+ case TY_LTO_IR:
+ case TY_LTO_BC:
+ return true;
+ }
+}
+
bool types::isCuda(ID Id) {
switch (Id) {
default:
OpenPOWER on IntegriCloud