[PATCH] D35081: [ThinLTO] Allow multiple summary entries.

Teresa Johnson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 11 07:55:37 PDT 2017


tejohnson added a comment.

In https://reviews.llvm.org/D35081#805127, @fhahn wrote:

> To reproduce the issue you could use
>
>   +; Check that we only add a single summary entry for multiple definitions
>   +; of a linkonce_odr function
>   +
>   +; RUN: opt -module-summary %s -o %t1.bc
>   +; RUN: opt -module-summary %s -o %t2.bc
>   +; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t1.bc %t2.bc
>   +; RUN: llvm-bcanalyzer -dump %t3.bc | FileCheck %s
>   +
>   +define linkonce_odr void @foo(i8*) {
>   +  ret void
>   +}
>   +; CHECK: <GLOBALVAL_SUMMARY_BLOCK
>   +; CHECK:  <VALUE_GUID
>   +; CHECK-NEXT:  <COMBINED
>   +; CHECK-NOT:  <COMBINED
>   +; CHECK: </GLOBALVAL_SUMMARY_BLOCK>
>
>
> I've been debugging this issue using an index + bitcode files provided by a third party, I'll try to get information on how they generated the index.


I understand how you can get multiple definitions of linkonce functions into a combined index dumped to  a file. But the clang code you are changing here is only invoked for a ThinLTO backend compile via clang (to support distributed builds), and should not be passed the full combined index. As mentioned in my first response, this isn't going to do what you want anyway, as the ThinLTO backend invoked via this path will import *everything* with a summary in the provided index (see a few lines down from your change, where we populate the ImportList entry for each summary in the provided index). Clang for a ThinLTO backend should only be passed an individual module's slice of the index, which can be produced for each of the input modules from llvm-lto via the -thinlto-action=distributedindexes option, or if linking via gold, with the -plugin-opt=thinlto-index-only option.

How is the third party trying to build with ThinLTO? If they are attempting distributed ThinLTO builds, then they need to invoke the thin link in such a way that they get these individual index files.


https://reviews.llvm.org/D35081





More information about the cfe-commits mailing list