mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-21 03:05:26 -04:00
[ModuleSummaryAnalysis] Don't crash when referencing unnamed globals.
Instead, just be conservative as these are unfrequent enough. Thanks to Peter Collingbourne for the discussion about this on IRC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@295861 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -447,6 +447,12 @@ ModuleSummaryIndex llvm::buildModuleSummaryIndex(
|
||||
auto &Summary = GlobalList.second[0];
|
||||
bool AllRefsCanBeExternallyReferenced =
|
||||
llvm::all_of(Summary->refs(), [&](const ValueInfo &VI) {
|
||||
// If a global value definition references an unnamed global,
|
||||
// be conservative. They're valid IR so we don't want to crash
|
||||
// when we encounter any of them but they're infrequent enough
|
||||
// that we don't bother optimizing them.
|
||||
if (!VI.getValue()->hasName())
|
||||
return false;
|
||||
return !CantBePromoted.count(VI.getValue()->getGUID());
|
||||
});
|
||||
if (!AllRefsCanBeExternallyReferenced) {
|
||||
|
||||
Reference in New Issue
Block a user