This is an archive of the discontinued LLVM Phabricator instance.

[IR] Track users of comdat
ClosedPublic

Authored by nikic on Dec 16 2021, 1:50 AM.

Details

Summary

Track all GlobalObjects that reference a given comdat, which allows determining whether a function in a comdat is dead without scanning the whole module.

In particular, this makes filterDeadComdatFunctions() have complexity O(#DeadFunctions) rather than O(#SymbolsInModule), which addressed half of the compile-time issue exposed by D115545.

Diff Detail

Unit TestsFailed

Event Timeline

nikic created this revision.Dec 16 2021, 1:50 AM
nikic requested review of this revision.Dec 16 2021, 1:50 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 16 2021, 1:50 AM
nikic updated this revision to Diff 395089.Dec 17 2021, 3:28 AM
nikic edited the summary of this revision. (Show Details)
nikic added a reviewer: aeubanks.

Add unit test for comdat user tracking.

presubmit is showing some lld test failures

nikic planned changes to this revision.Dec 17 2021, 10:15 AM

presubmit is showing some lld test failures

Looks like the bitcode reader is doing some magic with comdats: https://github.com/llvm/llvm-project/blob/f78c1b07cb263e77731b6f43eedd345bdcc3be08/llvm/lib/Bitcode/Reader/BitcodeReader.cpp#L3296

very nice!

llvm/lib/Transforms/Utils/ModuleUtils.cpp
201

or doesn't have a comdat

aeubanks accepted this revision.Jan 5 2022, 3:42 PM
This revision is now accepted and ready to land.Jan 5 2022, 3:42 PM
This revision was landed with ongoing or failed builds.Jan 6 2022, 12:14 AM
This revision was automatically updated to reflect the committed changes.
nikic marked an inline comment as done.