Extend LLVM IR WME to use thunks for cross-module witness method calls. (#39528)

This enables optimizing / dead-stripping of witness methods across modules at
LTO time.

- Under -internalize-at-link, restrict visibility of wtables to linkage unit.
- Emit thunks for cross-module wcalls when WME is enabled.
- Use thunks for wcalls across modules when WME is enabled.
- Adjust TBDGen to account for witness method thunks when WME is enabled.
- Add an IR test to check that thunks are used when doing cross-module calls.
- Add an end-to-end test case for cross-module WME.
This commit is contained in:
Kuba (Brecka) Mracek
2021-10-01 07:09:50 -07:00
committed by GitHub
parent d9931122d2
commit e405a9fae8
8 changed files with 145 additions and 6 deletions

View File

@@ -1542,6 +1542,7 @@ static bool ParseTBDGenArgs(TBDGenOptions &Opts, ArgList &Args,
Opts.IsInstallAPI = Args.hasArg(OPT_tbd_is_installapi);
Opts.VirtualFunctionElimination = Args.hasArg(OPT_enable_llvm_vfe);
Opts.WitnessMethodElimination = Args.hasArg(OPT_enable_llvm_wme);
if (const Arg *A = Args.getLastArg(OPT_tbd_compatibility_version)) {
Opts.CompatibilityVersion = A->getValue();