From 8d8582cf12c72b71775596ba8019b143c0b9cd03 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Wed, 3 May 2017 00:18:48 +0000 Subject: [PATCH] Revert r295861, "[ModuleSummaryAnalysis] Don't crash when referencing unnamed globals." We should always expect values to be named before running the module summary analysis (see NameAnonGlobals pass), so it's fine if we crash in that case. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301991 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ModuleSummaryAnalysis.cpp | 6 ------ test/Transforms/FunctionImport/unnamed-globals.ll | 10 ---------- 2 files changed, 16 deletions(-) delete mode 100644 test/Transforms/FunctionImport/unnamed-globals.ll diff --git a/lib/Analysis/ModuleSummaryAnalysis.cpp b/lib/Analysis/ModuleSummaryAnalysis.cpp index f6d9a73e4e9..a83412506a0 100644 --- a/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -451,12 +451,6 @@ 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) { diff --git a/test/Transforms/FunctionImport/unnamed-globals.ll b/test/Transforms/FunctionImport/unnamed-globals.ll deleted file mode 100644 index 167fad28f43..00000000000 --- a/test/Transforms/FunctionImport/unnamed-globals.ll +++ /dev/null @@ -1,10 +0,0 @@ -; Make sure we don't crash when referencing an unnamed global. -; RUN: opt %s -module-summary-analysis -S - -@0 = external global [1 x { i64 }] - -define internal void @tinkywinky() { - call void @patatino(i64 ptrtoint ([1 x { i64 }]* @0 to i64), i64 4) - ret void -} -declare void @patatino(i64, i64) -- 2.40.0