From 7ff99155c39edd73ebf1c6adfa023b1048fee9a4 Mon Sep 17 00:00:00 2001 From: rdivacky Date: Wed, 4 Nov 2009 14:58:56 +0000 Subject: Update LLVM to r86025. --- lib/Analysis/IPA/GlobalsModRef.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lib/Analysis/IPA/GlobalsModRef.cpp') diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp index 7949288..ddd6ff9 100644 --- a/lib/Analysis/IPA/GlobalsModRef.cpp +++ b/lib/Analysis/IPA/GlobalsModRef.cpp @@ -23,8 +23,7 @@ #include "llvm/DerivedTypes.h" #include "llvm/Analysis/AliasAnalysis.h" #include "llvm/Analysis/CallGraph.h" -#include "llvm/Analysis/MallocHelper.h" -#include "llvm/Support/Compiler.h" +#include "llvm/Analysis/MemoryBuiltins.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/InstIterator.h" #include "llvm/ADT/Statistic.h" @@ -44,7 +43,7 @@ namespace { /// function in the program. Later, the entries for these functions are /// removed if the function is found to call an external function (in which /// case we know nothing about it. - struct VISIBILITY_HIDDEN FunctionRecord { + struct FunctionRecord { /// GlobalInfo - Maintain mod/ref info for all of the globals without /// addresses taken that are read or written (transitively) by this /// function. @@ -69,8 +68,7 @@ namespace { }; /// GlobalsModRef - The actual analysis pass. - class VISIBILITY_HIDDEN GlobalsModRef - : public ModulePass, public AliasAnalysis { + class GlobalsModRef : public ModulePass, public AliasAnalysis { /// NonAddressTakenGlobals - The globals that do not have their addresses /// taken. std::set NonAddressTakenGlobals; @@ -240,6 +238,8 @@ bool GlobalsModRef::AnalyzeUsesOfPointer(Value *V, } else if (BitCastInst *BCI = dyn_cast(*UI)) { if (AnalyzeUsesOfPointer(BCI, Readers, Writers, OkayStoreDest)) return true; + } else if (isFreeCall(*UI)) { + Writers.push_back(cast(*UI)->getParent()->getParent()); } else if (CallInst *CI = dyn_cast(*UI)) { // Make sure that this is just the function being called, not that it is // passing into the function. @@ -261,8 +261,6 @@ bool GlobalsModRef::AnalyzeUsesOfPointer(Value *V, } else if (ICmpInst *ICI = dyn_cast(*UI)) { if (!isa(ICI->getOperand(1))) return true; // Allow comparison against null. - } else if (FreeInst *F = dyn_cast(*UI)) { - Writers.push_back(F->getParent()->getParent()); } else { return true; } @@ -439,7 +437,8 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) { if (cast(*II).isVolatile()) // Treat volatile stores as reading memory somewhere. FunctionEffect |= Ref; - } else if (isMalloc(&cast(*II)) || isa(*II)) { + } else if (isMalloc(&cast(*II)) || + isFreeCall(&cast(*II))) { FunctionEffect |= ModRef; } -- cgit v1.1