This is an archive of the discontinued LLVM Phabricator instance.

[LLD][RFC] Deduplicate type units with local ThinLTO
Needs ReviewPublic

Authored by ayermolo on Apr 19 2023, 4:14 PM.

Details

Reviewers
MaskRay
dblaikie
Summary

I ran into an issue where LLD wasn't de-duplicating type units (TU) with local
ThinLTO. A case is where one TU came from bitcode file build with local ThinLTO,
and another TU came from pre-build ELF object.
With distributed ThinLTO everything was de-duplicated as expected since inputs to
final link are just ELF files. This is a variation of if both type units come
from ThinLTO.

I took a look at https://reviews.llvm.org/D80765, which seems to go nowhere and
primarily just dealt with type units that come from ThinLTO. Due to it's
implementation it wouldn't work for mix mode.

Here I propose a more localized fix for this that just deals with type units. It
deals with a case where all type units come from ThinlTO, and with mix mode
case, and makes it so that behavior is the same between regular and distributed
ThinLTO.

P.S. I will add tests after it's clear that this isn't a dead end.

Diff Detail

Event Timeline

ayermolo created this revision.Apr 19 2023, 4:14 PM
Herald added a project: Restricted Project. · View Herald Transcript
Herald added subscribers: hoy, modimo, wenlei and 3 others. · View Herald Transcript
ayermolo requested review of this revision.Apr 19 2023, 4:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 19 2023, 4:14 PM
ayermolo updated this revision to Diff 515122.Apr 19 2023, 4:20 PM

a bit of cleanup

ayermolo updated this revision to Diff 515124.Apr 19 2023, 4:21 PM

a bit of cleanup