[PATCH] D28843: IRGen: Start using the WriteThinLTOBitcode pass.

Peter Collingbourne via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 18 13:02:22 PST 2017

pcc added inline comments.

Comment at: clang/lib/CodeGen/BackendUtil.cpp:694
+    else
+      PerModulePasses.add(
+          createBitcodeWriterPass(*OS, CodeGenOpts.EmitLLVMUseLists));
tejohnson wrote:
> Can we transform other callers of createBitcodeWriterPass with EmitSummaryIndex = true or EmitModuleHash = true to instead call createWriteThinLTOBitcodePass as you did here, and then remove those parameters from createBitcodeWriterPass?

The only other caller like that is in opt. I think that if we change the "under the hood" parts of opt we should change it to not use a pass at all (c.f. our earlier discussion on D27324), then remove those parameters.

Comment at: clang/test/CodeGenCXX/type-metadata-thinlto.cpp:2
+// RUN: %clang_cc1 -flto=thin -triple x86_64-unknown-linux -fvisibility hidden -emit-llvm-bc -o %t %s
+// RUN: llvm-modextract -o - -n 1 %t | llvm-dis | FileCheck %s
mehdi_amini wrote:
> tejohnson wrote:
> > Is it the case that now we will always split the module with this change? Should that only be done under CFI options?
> Devirtualization may happen whenever you have a hidden virtual table IIUC, independently of CFI.
To be more precise: we normally add type metadata in LTO mode when the class has hidden visibility. See: http://clang.llvm.org/docs/LTOVisibility.html

That doesn't necessarily imply devirtualization, which is controlled by the flag `-fwhole-program-vtables`.


More information about the cfe-commits mailing list