summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/IPA
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/IPA')
-rw-r--r--llvm/lib/Analysis/IPA/Andersens.cpp4
-rw-r--r--llvm/lib/Analysis/IPA/GlobalsModRef.cpp7
2 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/IPA/Andersens.cpp b/llvm/lib/Analysis/IPA/Andersens.cpp
index b5129a7d3ba..e37a9dbb7ac 100644
--- a/llvm/lib/Analysis/IPA/Andersens.cpp
+++ b/llvm/lib/Analysis/IPA/Andersens.cpp
@@ -1017,6 +1017,8 @@ bool Andersens::AnalyzeUsesOfFunction(Value *V) {
}
} else if (GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(*UI)) {
if (AnalyzeUsesOfFunction(GEP)) return true;
+ } else if (isa<FreeInst>(*UI) || isFreeCall(*UI)) {
+ return false;
} 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.
@@ -1038,8 +1040,6 @@ bool Andersens::AnalyzeUsesOfFunction(Value *V) {
} else if (ICmpInst *ICI = dyn_cast<ICmpInst>(*UI)) {
if (!isa<ConstantPointerNull>(ICI->getOperand(1)))
return true; // Allow comparison against null.
- } else if (isa<FreeInst>(*UI)) {
- return false;
} else {
return true;
}
diff --git a/llvm/lib/Analysis/IPA/GlobalsModRef.cpp b/llvm/lib/Analysis/IPA/GlobalsModRef.cpp
index 7949288340a..d83ea48080c 100644
--- a/llvm/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud