[llvm] r301991 - Revert r295861, "[ModuleSummaryAnalysis] Don't crash when referencing unnamed globals."

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 17:18:48 PDT 2017


Author: pcc
Date: Tue May  2 19:18:48 2017
New Revision: 301991

URL: http://llvm.org/viewvc/llvm-project?rev=301991&view=rev
Log:
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.

Removed:
    llvm/trunk/test/Transforms/FunctionImport/unnamed-globals.ll
Modified:
    llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp?rev=301991&r1=301990&r2=301991&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/ModuleSummaryAnalysis.cpp Tue May  2 19:18:48 2017
@@ -451,12 +451,6 @@ ModuleSummaryIndex llvm::buildModuleSumm
     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) {

Removed: llvm/trunk/test/Transforms/FunctionImport/unnamed-globals.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/FunctionImport/unnamed-globals.ll?rev=301990&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/FunctionImport/unnamed-globals.ll (original)
+++ llvm/trunk/test/Transforms/FunctionImport/unnamed-globals.ll (removed)
@@ -1,10 +0,0 @@
-; Make sure we don't crash when referencing an unnamed global.
-; RUN: opt %s -module-summary-analysis -S
-
- at 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)




More information about the llvm-commits mailing list