[Pipelines] Don't skip GlobalDCE in ThinLTO pre-link
authorNikita Popov <npopov@redhat.com>
Fri, 28 Apr 2023 13:29:49 +0000 (15:29 +0200)
committerNikita Popov <npopov@redhat.com>
Mon, 15 May 2023 12:58:24 +0000 (14:58 +0200)
commit3060ee0c6adaf3015e39c90a0929029b8d368522
tree385e71c60c4531e7e142abaf8125f858998e5ec3
parent7322d35476c34aa92720088554fb627154a99a6e
[Pipelines] Don't skip GlobalDCE in ThinLTO pre-link

GlobalDCE will only remove functions with available externally
linkage if they are unreferenced. As such, I don't believe there
is any problem with running this pass as part of the ThinLTO pre-link
pipeline. It will only remove functions that are completely dead in
that module, and I don't think there is any benefit to keeping them
around for the post-link phase.

There is no compile-time impact from the additional pass.

This is a followup to one of the side discussions in D146776.

Differential Revision: https://reviews.llvm.org/D149446
llvm/lib/Passes/PassBuilderPipelines.cpp
llvm/test/Other/new-pm-thinlto-prelink-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-pgo-defaults.ll
llvm/test/Other/new-pm-thinlto-prelink-samplepgo-defaults.ll