From 5593918b929954d878cb01225f46a4c50d1ba747 Mon Sep 17 00:00:00 2001 From: Bob Haarman Date: Mon, 15 Jul 2019 22:50:04 +0000 Subject: [PATCH] add -fthinlto-index= option to clang-cl Summary: This adds a -fthinlto-index= option to clang-cl, which allows it to be used to drive ThinLTO backend passes. This allows clang-cl to be used for distributed ThinLTO. Reviewers: tejohnson, pcc, rnk Subscribers: mehdi_amini, steven_wu, dexonsmith, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D64458 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366146 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Driver/Options.td | 2 +- test/Driver/cl-thinlto-backend.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/Driver/cl-thinlto-backend.c diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 957483c318..dfd27fab79 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1270,7 +1270,7 @@ def flto_jobs_EQ : Joined<["-"], "flto-jobs=">, "of 0 means the number of threads will be derived from " "the number of CPUs detected)">; def fthinlto_index_EQ : Joined<["-"], "fthinlto-index=">, - Flags<[CC1Option]>, Group, + Flags<[CoreOption, CC1Option]>, Group, HelpText<"Perform ThinLTO importing using provided function summary index">; def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">, Group, Flags<[DriverOption, CoreOption]>; diff --git a/test/Driver/cl-thinlto-backend.c b/test/Driver/cl-thinlto-backend.c new file mode 100644 index 0000000000..a948c4ea33 --- /dev/null +++ b/test/Driver/cl-thinlto-backend.c @@ -0,0 +1,9 @@ +// RUN: %clang_cl -c -flto=thin -Fo%t.obj %s +// RUN: llvm-lto2 run -thinlto-distributed-indexes -o %t.exe %t.obj + +// -fthinlto_index should be passed to cc1 +// RUN: %clang_cl -### -c -fthinlto-index=%t.thinlto.bc -Fo%t1.obj \ +// RUN: %t.obj 2>&1 | FileCheck %s + +// CHECK: -fthinlto-index= +// CHECK: "-x" "ir" -- 2.40.0