[PATCH] D53891: [LTO] Add option to enable LTOUnit splitting, and disable unless needed

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 18 21:23:10 PST 2018

pcc added a comment.

You can't emit the type tests by default with `-flto=thin` because not all programs adhere to the conditions described in `LTOVisibility.rst` and we can't silently break those programs; it is something that they will need to explicitly opt in to. We should be able to emit the `!type` annotations by default, just not the type tests.

Comment at: lib/CodeGen/BackendUtil.cpp:831
+          *OS, CodeGenOpts.EmitLLVMUseLists, EmitLTOSummary,
+          /*EmitModuleHash=*/false));
Why add this argument here (and below)?

Comment at: lib/Driver/ToolChains/Clang.cpp:5112
+  bool EnableSplitLTOUnit = Args.hasFlag(
+      options::OPT_fsplit_lto_unit, options::OPT_fno_split_lto_unit, false);
+  if (EnableSplitLTOUnit || WholeProgramVTables || Sanitize.needsLTO()) {
Should this default to `WholeProgramVTables || Sanitize.needsLTO()` and emit an error if the user passes the (for now) unsupported combinations `-fno-split-lto-unit -fwhole-program-vtables` or `-fno-split-lto-unit -fsanitize=cfi`?

  rC Clang



More information about the cfe-commits mailing list