diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-04 14:58:56 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2009-11-04 14:58:56 +0000 | 
| commit | 36bf506ad3c99a309ca8bd73bd03563d8d068ac0 (patch) | |
| tree | b4dc751bcee540346911aa4115729eff2f991657 /lib/Analysis/IPA/GlobalsModRef.cpp | |
| parent | f9666f9b3a3d26810deae8cd54feb6e47ecee61a (diff) | |
Notes
Diffstat (limited to 'lib/Analysis/IPA/GlobalsModRef.cpp')
| -rw-r--r-- | lib/Analysis/IPA/GlobalsModRef.cpp | 15 | 
1 files changed, 7 insertions, 8 deletions
| diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp index 7949288340a8..ddd6ff9bd825 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<GlobalValue*> NonAddressTakenGlobals; @@ -240,6 +238,8 @@ bool GlobalsModRef::AnalyzeUsesOfPointer(Value *V,      } else if (BitCastInst *BCI = dyn_cast<BitCastInst>(*UI)) {        if (AnalyzeUsesOfPointer(BCI, Readers, Writers, OkayStoreDest))          return true; +    } else if (isFreeCall(*UI)) { +      Writers.push_back(cast<Instruction>(*UI)->getParent()->getParent());      } else if (CallInst *CI = dyn_cast<CallInst>(*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<ICmpInst>(*UI)) {        if (!isa<ConstantPointerNull>(ICI->getOperand(1)))          return true;  // Allow comparison against null. -    } else if (FreeInst *F = dyn_cast<FreeInst>(*UI)) { -      Writers.push_back(F->getParent()->getParent());      } else {        return true;      } @@ -439,7 +437,8 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {            if (cast<StoreInst>(*II).isVolatile())              // Treat volatile stores as reading memory somewhere.              FunctionEffect |= Ref; -        } else if (isMalloc(&cast<Instruction>(*II)) || isa<FreeInst>(*II)) { +        } else if (isMalloc(&cast<Instruction>(*II)) || +                   isFreeCall(&cast<Instruction>(*II))) {            FunctionEffect |= ModRef;          } | 
