From: Chris Lattner Date: Thu, 21 Apr 2005 16:08:59 +0000 (+0000) Subject: add support for taking the address of free. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=07753cecb986cbedf1fbc21fb8b6b98492896b2f;p=oota-llvm.git add support for taking the address of free. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21395 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/Analysis/DataStructure/DataStructure.h b/include/llvm/Analysis/DataStructure/DataStructure.h index a05935ac210..32299473f48 100644 --- a/include/llvm/Analysis/DataStructure/DataStructure.h +++ b/include/llvm/Analysis/DataStructure/DataStructure.h @@ -126,14 +126,17 @@ public: DSGraph &getDSGraph(const Function &F) const { hash_map::const_iterator I = DSInfo.find(const_cast(&F)); - assert(I != DSInfo.end() && "Function not in module!"); - return *I->second; + if (I != DSInfo.end()) + return *I->second; + return const_cast(this)-> + CreateGraphForExternalFunction(F); } DSGraph &getGlobalsGraph() const { return *GlobalsGraph; } EquivalenceClasses &getGlobalECs() { return GlobalECs; } + DSGraph &CreateGraphForExternalFunction(const Function &F); /// deleteValue/copyValue - Interfaces to update the DSGraphs in the program. /// These correspond to the interfaces defined in the AliasAnalysis class. @@ -234,8 +237,9 @@ public: DSGraph &getDSGraph(const Function &F) const { hash_map::const_iterator I = DSInfo.find(const_cast(&F)); - assert(I != DSInfo.end() && "Function not in module!"); - return *I->second; + if (I != DSInfo.end()) return *I->second; + return const_cast(this)-> + getOrCreateDSGraph(const_cast(F)); } DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }