[IR] Track users of comdats
authorNikita Popov <npopov@redhat.com>
Thu, 16 Dec 2021 09:48:40 +0000 (10:48 +0100)
committerNikita Popov <npopov@redhat.com>
Thu, 6 Jan 2022 08:13:58 +0000 (09:13 +0100)
commit32808cfb24b8d83a99223b7f797be1dbe5573c10
tree3db158967e5bf6f36a09d1eb52355c95aad5d055
parent49d311874edc928831ccaddd621801a4dbee580d
[IR] Track users of comdats

Track all GlobalObjects that reference a given comdat, which allows
determining whether a function in a comdat is dead without scanning
the whole module.

In particular, this makes filterDeadComdatFunctions() have complexity
O(#DeadFunctions) rather than O(#SymbolsInModule), which addresses
half of the compile-time issue exposed by D115545.

Differential Revision: https://reviews.llvm.org/D115864
llvm/include/llvm/IR/Comdat.h
llvm/include/llvm/IR/GlobalObject.h
llvm/lib/IR/Comdat.cpp
llvm/lib/IR/Globals.cpp
llvm/lib/Transforms/Utils/ModuleUtils.cpp
llvm/unittests/IR/ConstantsTest.cpp