This is an archive of the discontinued LLVM Phabricator instance.

[ThinLTO] - Simplify code in ThinLTOBitcodeWriter.
ClosedPublic

Authored by grimar on Feb 6 2018, 8:18 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Feb 6 2018, 8:18 AM
tejohnson accepted this revision.Feb 6 2018, 8:35 AM

LGTM with the below changes. Thanks for the cleanup!

lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
174 ↗(On Diff #133007)

Recommend keeping the old callback name - it still fits the behavior and reduces unnecessary churn.

178 ↗(On Diff #133007)

s/GA/GV/ since to match the data type.

This revision is now accepted and ready to land.Feb 6 2018, 8:35 AM
This revision was automatically updated to reflect the committed changes.
grimar reopened this revision.Feb 7 2018, 4:12 AM
This revision is now accepted and ready to land.Feb 7 2018, 4:12 AM
grimar updated this revision to Diff 133194.Feb 7 2018, 5:29 AM

Reimplemented.

grimar requested review of this revision.Feb 7 2018, 5:29 AM

Sorry, I had to revert it after commit, it broke few bots.

It happened because it turned out that order of proccessing
globals is important here, with 'ShouldKeepDefinition' implementation
it works only if aliases are dropped first (like original code did)
(https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp#L320)
otherwise if we drop the aliasee's metadata first, condition
if (HasTypeMetadata(... will never trigger for alias and we never drop it.

I suggest to use work list then. It even makes code a bit more simple.
Updated the patch, verified that check-all pass.

This revision is now accepted and ready to land.Feb 7 2018, 8:53 AM
This revision was automatically updated to reflect the committed changes.