[clang] ef7a154 - [clang][ThinLTO] Promote cc1 -fthin_link_bitcode to driver -fthinlto_link_bitcode
Yuanfang Chen via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 24 17:45:42 PDT 2019
Author: Yuanfang Chen
Date: 2019-10-24T16:54:45-07:00
New Revision: ef7a154d17f2e38ba3c8bfa33f240b60464e4cc7
URL: https://github.com/llvm/llvm-project/commit/ef7a154d17f2e38ba3c8bfa33f240b60464e4cc7
DIFF: https://github.com/llvm/llvm-project/commit/ef7a154d17f2e38ba3c8bfa33f240b60464e4cc7.diff
LOG: [clang][ThinLTO] Promote cc1 -fthin_link_bitcode to driver -fthinlto_link_bitcode
Summary:
A necessary step to let build system caching work for its output.
Reviewers: tejohnson, steven_wu
Reviewed by: tejohnson
Subscribers: mehdi_amini, inglorion, dexonsmith, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D69406
Added:
Modified:
clang/include/clang/Driver/CC1Options.td
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CodeGen/thin_link_bitcode.c
Removed:
################################################################################
diff --git a/clang/include/clang/Driver/CC1Options.td b/clang/include/clang/Driver/CC1Options.td
index 4518aca82ef6..72019aa2a01a 100644
--- a/clang/include/clang/Driver/CC1Options.td
+++ b/clang/include/clang/Driver/CC1Options.td
@@ -387,8 +387,6 @@ def flto_visibility_public_std:
def flto_unit: Flag<["-"], "flto-unit">,
HelpText<"Emit IR to support LTO unit features (CFI, whole program vtable opt)">;
def fno_lto_unit: Flag<["-"], "fno-lto-unit">;
-def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
- HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">;
def femit_debug_entry_values : Flag<["-"], "femit-debug-entry-values">,
HelpText<"Enables debug info about call site parameter's entry values">;
def fdebug_pass_manager : Flag<["-"], "fdebug-pass-manager">,
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 20d7c241a937..1c3d7f77707e 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1312,6 +1312,9 @@ def flto_jobs_EQ : Joined<["-"], "flto-jobs=">,
def fthinlto_index_EQ : Joined<["-"], "fthinlto-index=">,
Flags<[CoreOption, CC1Option]>, Group<f_Group>,
HelpText<"Perform ThinLTO importing using provided function summary index">;
+def fthin_link_bitcode_EQ : Joined<["-"], "fthin-link-bitcode=">,
+ Flags<[CoreOption, CC1Option]>, Group<f_Group>,
+ HelpText<"Write minimized bitcode to <file> for the ThinLTO thin link only">;
def fmacro_backtrace_limit_EQ : Joined<["-"], "fmacro-backtrace-limit=">,
Group<f_Group>, Flags<[DriverOption, CoreOption]>;
def fmerge_all_constants : Flag<["-"], "fmerge-all-constants">, Group<f_Group>,
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 198b0b5b228f..70c70dcdbd4d 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3641,6 +3641,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddLastArg(CmdArgs, options::OPT_fthinlto_index_EQ);
}
+ if (Args.getLastArg(options::OPT_fthin_link_bitcode_EQ))
+ Args.AddLastArg(CmdArgs, options::OPT_fthin_link_bitcode_EQ);
+
if (Args.getLastArg(options::OPT_save_temps_EQ))
Args.AddLastArg(CmdArgs, options::OPT_save_temps_EQ);
diff --git a/clang/test/CodeGen/thin_link_bitcode.c b/clang/test/CodeGen/thin_link_bitcode.c
index 52c5715ba561..052af9fd22c8 100644
--- a/clang/test/CodeGen/thin_link_bitcode.c
+++ b/clang/test/CodeGen/thin_link_bitcode.c
@@ -1,5 +1,7 @@
// REQUIRES: x86-registered-target
//
+// RUN: %clang -flto=thin -fthin-link-bitcode=%t.bc -target x86_64-unknown-linux-gnu -### %s 2>&1 | FileCheck %s --check-prefix=LINKBC
+//
// RUN: %clang_cc1 -o %t -flto=thin -fthin-link-bitcode=%t.nodebug -triple x86_64-unknown-linux-gnu -emit-llvm-bc -debug-info-kind=limited %s
// RUN: llvm-bcanalyzer -dump %t | FileCheck %s
// RUN: llvm-bcanalyzer -dump %t.nodebug | FileCheck %s --check-prefix=NO_DEBUG
@@ -10,5 +12,7 @@ int main (void) {
return 0;
}
+// LINKBC: -fthin-link-bitcode=
+
// CHECK: COMPILE_UNIT
// NO_DEBUG-NOT: COMPILE_UNIT
More information about the cfe-commits
mailing list