From 33e3b4b9b3b3c2fb5b30bd618c02adbe30d81c0f Mon Sep 17 00:00:00 2001 From: Xin Tong Date: Wed, 2 Jan 2019 23:18:20 +0000 Subject: [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 --- llvm/lib/Transforms/IPO/FunctionImport.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp') 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 &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 -- cgit v1.2.3