[PATCH] D25300: ThinLTO: handles modules with empty summaries

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 07:45:33 PDT 2016


tejohnson added a comment.

> We need to add an entry in the combined-index for modules that have
>  a hash but otherwise empty summary, this is needed so that we can
>  get the hash for the module.

I'm confused because it appears the patch will actually prevent adding an entry in the combined index if the module has an empty summary (ThinLTOCodeGenerator::linkCombinedIndex).



> BitcodeReader.cpp:6151
> +            // We always seed the index with the module.
> +            TheIndex->addModulePath(Buffer->getBufferIdentifier(), 0);
>            if (TheIndex->modulePaths().size() != 1)

I think we should just do the addModulePath unconditionally at the top of this routine if we have an index. Then we could assert here that we have module paths. And the other places where we addModulePath would just change to assert/access.

But why is this needed if we are later going to prevent adding this to the combined index since it has an empty summary section?

> LTO.cpp:381
>    MemoryBufferRef MBRef = Input->Obj->getMemoryBufferRef();
> +  errs() << "Load buffer " << MBRef.getBufferIdentifier() << "\n";
>    ErrorOr<std::unique_ptr<object::ModuleSummaryIndexObjectFile>>

Leftover debugging message

> ThinLTOCodeGenerator.cpp:278
> +      if (DefinedFunctions.count(Entry)) {
> +        errs() << "PreservedSymbols " << Entry << "\n";
>          Hasher.update(

Leftover debugging message.

> ThinLTOCodeGenerator.cpp:512
> +    // If the index is not empty, add it to the combined index
> +    if (Index->begin() != Index->end()) {
> +      if (CombinedIndex)

Is a similar change required in LTO::addThinLTO (guarding the call to mergeFrom())?

> empty_module_with_cache.ll:14
> +; RUN:  -r=%t2.bc,_main,plx 
> +; RUN: ls %t.cache | count 1
> +

Why do we have 1 cache entry for llvm-lto2 but 2 for llvm-lto?

> llvm-lto.cpp:393
>      auto CurrentActivity = "loading file '" + Filename + "'";
> +    errs() << CurrentActivity << "\n";
>      auto InputOrErr = MemoryBuffer::getFile(Filename);

Leftover debugging message.

https://reviews.llvm.org/D25300





More information about the llvm-commits mailing list