From 21a79edb2739d819b05ee534c9981f3bedacee95 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 15 Mar 2005 22:10:04 +0000 Subject: [PATCH] fix crashes when we only have a prototype for main. llvm-svn: 20627 --- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp | 2 +- llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp | 2 +- llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp b/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp index 6c26602889cf..91cfc7c14ebc 100644 --- a/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp +++ b/llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp @@ -85,7 +85,7 @@ bool BUDataStructures::runOnModule(Module &M) { // Merge the globals variables (not the calls) from the globals graph back // into the main function's graph so that the main function contains all of // the information about global pools and GV usage in the program. - if (MainFunc) { + if (MainFunc && !MainFunc->isExternal()) { DSGraph &MainGraph = getOrCreateGraph(MainFunc); const DSGraph &GG = *MainGraph.getGlobalsGraph(); ReachabilityCloner RC(MainGraph, GG, diff --git a/llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp b/llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp index 4dcfc354833e..5a0436c0616b 100644 --- a/llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp +++ b/llvm/lib/Analysis/DataStructure/CompleteBottomUp.cpp @@ -94,7 +94,7 @@ bool CompleteBUDataStructures::runOnModule(Module &M) { // Merge the globals variables (not the calls) from the globals graph back // into the main function's graph so that the main function contains all of // the information about global pools and GV usage in the program. - if (MainFunc) { + if (MainFunc && !MainFunc->isExternal()) { DSGraph &MainGraph = getOrCreateGraph(*MainFunc); const DSGraph &GG = *MainGraph.getGlobalsGraph(); ReachabilityCloner RC(MainGraph, GG, diff --git a/llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp b/llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp index 2ddc684e0104..e895ef3c1355 100644 --- a/llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp +++ b/llvm/lib/Analysis/DataStructure/EquivClassGraphs.cpp @@ -106,7 +106,7 @@ bool EquivClassGraphs::runOnModule(Module &M) { // Merge the globals variables (not the calls) from the globals graph back // into the main function's graph so that the main function contains all of // the information about global pools and GV usage in the program. - if (MainFunc) { + if (MainFunc && !MainFunc->isExternal()) { DSGraph &MainGraph = getOrCreateGraph(*MainFunc); const DSGraph &GG = *MainGraph.getGlobalsGraph(); ReachabilityCloner RC(MainGraph, GG,