diff options
author | Victor Hernandez <vhernandez@apple.com> | 2009-10-24 04:23:03 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2009-10-24 04:23:03 +0000 |
commit | 66284e063a1e46500acae48bdc0e4a00652021d1 (patch) | |
tree | 7326efcf20c334046c044082a205dc2eb1f17466 /lib/Analysis/IPA/GlobalsModRef.cpp | |
parent | 5a850beb2e3032e6ff3474ce5317f5454060328c (diff) |
Auto-upgrade free instructions to calls to the builtin free function.
Update all analysis passes and transforms to treat free calls just like FreeInst.
Remove RaiseAllocations and all its tests since FreeInst no longer needs to be raised.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84987 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/IPA/GlobalsModRef.cpp')
-rw-r--r-- | lib/Analysis/IPA/GlobalsModRef.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp index 7949288340..d83ea48080 100644 --- a/lib/Analysis/IPA/GlobalsModRef.cpp +++ b/lib/Analysis/IPA/GlobalsModRef.cpp @@ -240,6 +240,8 @@ bool GlobalsModRef::AnalyzeUsesOfPointer(Value *V, } else if (BitCastInst *BCI = dyn_cast<BitCastInst>(*UI)) { if (AnalyzeUsesOfPointer(BCI, Readers, Writers, OkayStoreDest)) return true; + } else if (isa<FreeInst>(*UI) || 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 +263,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 +439,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)) || isa<FreeInst>(*II) || + isFreeCall(&cast<Instruction>(*II))) { FunctionEffect |= ModRef; } |