This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] Always create linked objects file for --thinlto-index-only=
ClosedPublic

Authored by vitalybuka on Feb 16 2018, 2:51 PM.

Details

Summary

ThinLTO indexing may decide to skip all objects. If we don't write something to
the list build system may consider this as failure or linker can reuse a file
from the previews build.

Diff Detail

Repository
rL LLVM

Event Timeline

vitalybuka created this revision.Feb 16 2018, 2:51 PM
tejohnson added inline comments.Feb 20 2018, 8:23 AM
llvm/include/llvm/LTO/LTO.h
219 ↗(On Diff #134731)

While here, can you add the missing documentation for this parameter?

llvm/lib/LTO/LTO.cpp
1037 ↗(On Diff #134731)

We only have one backend object - why use a shared_ptr instead of a unique_ptr?

llvm/tools/gold/gold-plugin.cpp
739 ↗(On Diff #134731)

s/return/returns/

742 ↗(On Diff #134731)

Suggest changing order to do early return of nullptr if filename is empty.

vitalybuka marked 4 inline comments as done.

addressed comments

vitalybuka added inline comments.Feb 20 2018, 5:17 PM
llvm/lib/LTO/LTO.cpp
1037 ↗(On Diff #134731)

No easy way to capture unique_ptr and copy that into std::function in c++11.
I can avoid transferring stream ownership. But to my taste shared_ptr version was better.

tejohnson accepted this revision.Feb 22 2018, 9:05 AM

LGTM

llvm/lib/LTO/LTO.cpp
1037 ↗(On Diff #134731)

I see, thanks for the explanation. I think I prefer then keeping the ownership in the client as you have done here.

llvm/tools/gold/gold-plugin.cpp
740 ↗(On Diff #135177)

s/OnWrite/OnIndexWrite/

This revision is now accepted and ready to land.Feb 22 2018, 9:05 AM
vitalybuka marked an inline comment as done.

fixed doc string

This revision was automatically updated to reflect the committed changes.