This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Remove LinkAll*.h
ClosedPublic

Authored by aeubanks on Nov 1 2021, 4:47 PM.

Details

Summary

These were added to prevent functions from being removed by WPO.

But that doesn't make sense, correct WPO will not remove functions we actually use.

I noticed these because compiling cc1_main.cpp was pulling in random LLVM pass headers.

Diff Detail

Event Timeline

aeubanks created this revision.Nov 1 2021, 4:47 PM
aeubanks requested review of this revision.Nov 1 2021, 4:47 PM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript
MaskRay accepted this revision.Nov 1 2021, 5:02 PM

LGTM.

This revision is now accepted and ready to land.Nov 1 2021, 5:02 PM
This revision was landed with ongoing or failed builds.Nov 2 2021, 8:44 AM
This revision was automatically updated to reflect the committed changes.

Turns out the comments are misleading, they aren't to prevent specific functions from being removed, they're to force an odr usage of various functions, which in turn makes sure that globals in the corresponding translation units with the function definition are initialized. Those globals populate registries that are necessary.

My understanding is that this is necessary for the legacy pass manager that uses a global registration system - if you didn't reference any function in the pass, then the code wouldn't get linked in - because the only way the pass was accessed was through the registry?

Does that sound right? Did this change break some legacy pass manager registry functionality? Am I just generally misremembering/misunderstanding how this worked or something changed to remove that model entirely?

My understanding is that this is necessary for the legacy pass manager that uses a global registration system - if you didn't reference any function in the pass, then the code wouldn't get linked in - because the only way the pass was accessed was through the registry?

Does that sound right? Did this change break some legacy pass manager registry functionality? Am I just generally misremembering/misunderstanding how this worked or something changed to remove that model entirely?

Oh, I see, you caught that and reverted it for that reason - no worries then!

the comments were misleading, I updated them in D113074

llvm/include/llvm/LinkAllIR.h