diff options
| author | Teresa Johnson <tejohnson@google.com> | 2019-10-01 18:08:29 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2019-10-01 18:08:29 +0000 |
| commit | dca5b94e798cfb99102116ff2e7ea4f9d184722b (patch) | |
| tree | 3e6d70080c2d8efd6ef7376d267f27045c0aa6dc /clang | |
| parent | e0fa2689de53a8c711974bfa80d4aadd913e6984 (diff) | |
| download | bcm5719-llvm-dca5b94e798cfb99102116ff2e7ea4f9d184722b.tar.gz bcm5719-llvm-dca5b94e798cfb99102116ff2e7ea4f9d184722b.zip | |
[ThinLTO] Enable index-only WPD from clang
Summary:
To trigger the index-only Whole Program Devirt support added to LLVM, we
need to be able to specify -fno-split-lto-unit in conjunction with
-fwhole-program-vtables. Keep the default for -fwhole-program-vtables as
-fsplit-lto-unit, but don't error on that option combination.
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D68029
llvm-svn: 373370
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/Driver/ToolChains/Clang.cpp | 11 | ||||
| -rw-r--r-- | clang/test/Driver/split-lto-unit.c | 2 |
2 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp index 309ce7fdc75..8628741f7da 100644 --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -5456,14 +5456,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-fwhole-program-vtables"); } - bool RequiresSplitLTOUnit = WholeProgramVTables || Sanitize.needsLTO(); + bool DefaultsSplitLTOUnit = WholeProgramVTables || Sanitize.needsLTO(); bool SplitLTOUnit = Args.hasFlag(options::OPT_fsplit_lto_unit, - options::OPT_fno_split_lto_unit, RequiresSplitLTOUnit); - if (RequiresSplitLTOUnit && !SplitLTOUnit) - D.Diag(diag::err_drv_argument_not_allowed_with) - << "-fno-split-lto-unit" - << (WholeProgramVTables ? "-fwhole-program-vtables" : "-fsanitize=cfi"); + options::OPT_fno_split_lto_unit, DefaultsSplitLTOUnit); + if (Sanitize.needsLTO() && !SplitLTOUnit) + D.Diag(diag::err_drv_argument_not_allowed_with) << "-fno-split-lto-unit" + << "-fsanitize=cfi"; if (SplitLTOUnit) CmdArgs.push_back("-fsplit-lto-unit"); diff --git a/clang/test/Driver/split-lto-unit.c b/clang/test/Driver/split-lto-unit.c index fab5790c26b..d2ed253ca20 100644 --- a/clang/test/Driver/split-lto-unit.c +++ b/clang/test/Driver/split-lto-unit.c @@ -6,5 +6,5 @@ // UNIT: "-fsplit-lto-unit" // NOUNIT-NOT: "-fsplit-lto-unit" -// ERROR1: error: invalid argument '-fno-split-lto-unit' not allowed with '-fwhole-program-vtables' +// ERROR1-NOT: error: invalid argument // ERROR2: error: invalid argument '-fno-split-lto-unit' not allowed with '-fsanitize=cfi' |

