GlobalOpt: Preserve comdats of unoptimized initializers
authorReid Kleckner <reid@kleckner.net>
Tue, 23 Sep 2014 22:33:01 +0000 (22:33 +0000)
committerReid Kleckner <reid@kleckner.net>
Tue, 23 Sep 2014 22:33:01 +0000 (22:33 +0000)
commit8577eaf8e6b1b660554a4c2b03e61a58e0219c39
tree210e4d68c2ed49777be112a3827e94c03c440b35
parentbd847644b3aa71eb03cb5c71ef96c22ce9183505
GlobalOpt: Preserve comdats of unoptimized initializers

Rather than slurping in and splatting out the whole ctor list, preserve
the existing array entries without trying to understand them.  Only
remove the entries that we know we can optimize away.  This way we don't
need to wire through priority and comdats or anything else we might add.

Fixes a linker issue where the .init_array or .ctors entry would point
to discarded initialization code if the comdat group from the TU with
the faulty global_ctors entry was dropped.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218337 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/CtorUtils.cpp
test/Transforms/GlobalOpt/preserve-comdats.ll [new file with mode: 0644]