[PATCH] D149446: [Pipelines] Don't skip GlobalDCE in ThinLTO pre-link

Mingming Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 12:18:33 PDT 2023


mingmingl added inline comments.


================
Comment at: llvm/lib/Passes/PassBuilderPipelines.cpp:1116
-  // Remove dead code, except in the ThinLTO pre-link pipeline where we may want
-  // to keep available_externally functions.
-  if (Phase != ThinOrFullLTOPhase::ThinLTOPreLink)
----------------
This comment reminds me of another comment https://github.com/llvm/llvm-project/blob/4b80a8c72d3d0dba4ee2469471dfccb7e257b319/llvm/lib/Passes/PassBuilderPipelines.cpp#L983-l986, which points out in postlink (after function import) available_externally functions may appear unreferenced, if the function is referenced as virtual table indirect calls, so ICP pass runs before global-opt pass.

I don't know how functions become `available_externally` symbols in prelink (e.g., a small c++ example) stage, but wonder if the same 'seemingly unreferenced' but indeed referenced pattern is relevant here.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149446/new/

https://reviews.llvm.org/D149446



More information about the llvm-commits mailing list