This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO/LTO] Don't link in unneeded metadata
ClosedPublic

Authored by tejohnson on Nov 19 2015, 2:33 PM.

Details

Summary

Third patch split out from http://reviews.llvm.org/D14752.

Only map in needed DISubroutine metadata (imported or otherwise linked
in functions and other DISubroutine referenced by inlined instructions).
This is supported for ThinLTO, LTO and llvm-link --only-needed, with
associated tests for each one.

Depends on D14838.

Diff Detail

Event Timeline

tejohnson updated this revision to Diff 40706.Nov 19 2015, 2:33 PM
tejohnson retitled this revision from to [ThinLTO/LTO] Don't link in unneeded metadata.
tejohnson updated this object.
tejohnson added reviewers: dexonsmith, mehdi_amini.
tejohnson added subscribers: llvm-commits, davidxl.

Ping.
Thanks, Teresa

mehdi_amini added inline comments.Dec 1 2015, 12:44 PM
lib/Linker/LinkModules.cpp
482

Replace with a real member instead of a pointer.

1069

And test for emptiness instead of null.

1793

Remove :)

1826

Is there a test for this? I'm not sure I saw a CHECK-NOT: null line or something equivalent?

1828

early exit

mehdi_amini edited edge metadata.Dec 1 2015, 12:45 PM

LGTM with the previous comments :)

tejohnson marked 2 inline comments as done.Dec 18 2015, 9:47 AM

Thanks for the review. Rebased and addressed all your comments. Final version going in shortly.

lib/Linker/LinkModules.cpp
482

Done, along with your related suggestions that fall out as a result of this change.

1826

I added one to test/Linker/thinlto_funcimport_debug.ll. Turns out there is a verifier assert that fires if you have null in the SP list. I had to comment that out temporarily to test my new check. But I think it makes sense to check for it explicitly in the test case too.

1828

Done

This revision was automatically updated to reflect the committed changes.

I'm getting segfaults where CU->getSubprograms() in findNeededSubprograms is returning null and then being dereferenced.

See https://llvm.org/bugs/show_bug.cgi?id=25917

Commenting here so that hopefully the right people see the bug.

Hi Andrew,

This was also reported in https://llvm.org/bugs/show_bug.cgi?id=25915
and I have a fix, just working on a test case.

Teresa

Looks like Ivan beat me to it. Thanks Teresa, and sorry for the duplicate
bug.

  • Andrew