diff options
author | Xin Tong <trent.xin.tong@gmail.com> | 2019-01-02 23:18:20 +0000 |
---|---|---|
committer | Xin Tong <trent.xin.tong@gmail.com> | 2019-01-02 23:18:20 +0000 |
commit | 33e3b4b9b3b3c2fb5b30bd618c02adbe30d81c0f (patch) | |
tree | 7bcdc209b44baba411b08c7bb996fca4a6993bcb /llvm/lib/Transforms/IPO/FunctionImport.cpp | |
parent | 9eba99ba664c12beabba16bf58d9a073c2240737 (diff) | |
download | bcm5719-llvm-33e3b4b9b3b3c2fb5b30bd618c02adbe30d81c0f.tar.gz bcm5719-llvm-33e3b4b9b3b3c2fb5b30bd618c02adbe30d81c0f.zip |
[ThinLTO] Scan all variants of vague symbol for reachability.
Summary:
Alias can make one (but not all) live, we still need to scan all others if this symbol is reachable
from somewhere else.
Reviewers: tejohnson, grimar
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D56117
llvm-svn: 350269
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 531a7c19e36..1223a23512e 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -777,9 +777,14 @@ void llvm::computeDeadSymbols( VI = updateValueInfoForIndirectCalls(Index, VI); if (!VI) return; - for (auto &S : VI.getSummaryList()) - if (S->isLive()) - return; + + // We need to make sure all variants of the symbol are scanned, alias can + // make one (but not all) alive. + if (llvm::all_of(VI.getSummaryList(), + [](const std::unique_ptr<llvm::GlobalValueSummary> &S) { + return S->isLive(); + })) + return; // We only keep live symbols that are known to be non-prevailing if any are // available_externally, linkonceodr, weakodr. Those symbols are discarded |