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.
Paths
| Differential D112971
[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 TimelineThis 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. aeubanks added a reverting change: rGe2024d72fae7: Revert "[NFC] Remove LinkAll*.h".Nov 2 2021, 9:09 AM Comment Actions 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. Comment Actions 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? Comment Actions
Oh, I see, you caught that and reverted it for that reason - no worries then!
Revision Contents
Diff 384126 clang/tools/driver/cc1_main.cpp
llvm/docs/WritingAnLLVMPass.rst
llvm/include/llvm/CodeGen/LinkAllAsmWriterComponents.h
llvm/include/llvm/CodeGen/LinkAllCodegenComponents.h
llvm/include/llvm/LinkAllIR.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/module.modulemap
llvm/lib/Analysis/CallPrinter.cpp
llvm/lib/Analysis/DomPrinter.cpp
llvm/lib/Analysis/RegionInfo.cpp
llvm/lib/CodeGen/MachineRegionInfo.cpp
llvm/tools/bugpoint/bugpoint.cpp
llvm/tools/llc/llc.cpp
llvm/tools/lli/lli.cpp
llvm/tools/opt/opt.cpp
|