OSDN Git Service

ThinLTOBitcodeWriter: Try harder to discard unused references to the merged module.
authorPeter Collingbourne <peter@pcc.me.uk>
Thu, 30 Nov 2017 23:05:52 +0000 (23:05 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Thu, 30 Nov 2017 23:05:52 +0000 (23:05 +0000)
commit31b9aa7755ac3384498f544058d93b5eea164458
tree4c7e70b577d0bbad4993af9f28d7d322c034fc3b
parent50d97d4026888af76fd1b7e7da56f4dc40247ad0
ThinLTOBitcodeWriter: Try harder to discard unused references to the merged module.

If the thin module has no references to an internal global in the
merged module, we need to make sure to preserve that property if the
global is a member of a comdat group, as otherwise promotion can end
up adding global symbols to the comdat, which is not allowed.

This situation can arise if the external global in the thin module
has dead constant users, which would cause use_empty() to return
false and would cause us to try to promote it. To prevent this from
happening, discard the dead constant users before asking whether a
global is empty.

Differential Revision: https://reviews.llvm.org/D40593

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319494 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
test/Transforms/ThinLTOBitcodeWriter/filter-alias.ll