[llvm] Linker: Remove dropTriviallyDeadConstantArrays(). (PR #137081)

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 25 19:22:06 PDT 2025


pcc wrote:

Each of our translation units with a `cl::opt` will have an `llvm.global_ctors` entry so I would expect clang to exercise this case fairly realistically given the number of translation units we have that declare flags. I would also expect that clang overrepresents this case; most large C++ programs that I'm aware of try to avoid global constructors (see e.g. [Google's style guide](https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables)).

I probably wouldn't try to optimize this preemptively in any case; even if the issue somehow still exists it's possible that anyone who previously cared about it has moved to ThinLTO (the patch that introduced `dropTriviallyDeadConstantArrays` predates ThinLTO) which doesn't import appending arrays so I reckon we should make the change and see if anyone complains.

https://github.com/llvm/llvm-project/pull/137081


More information about the llvm-commits mailing list