aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO/FunctionAttrs.cpp
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2010-11-03 14:45:05 +0000
committerDuncan Sands <baldrick@free.fr>2010-11-03 14:45:05 +0000
commit391f5bce046e229a8d52faf317a7ab980aff0dbb (patch)
tree4ea1c0aac0cc9288515ecb3763d3c03b409b16c2 /lib/Transforms/IPO/FunctionAttrs.cpp
parentcdfad36b401be6fc709ea4051f9de58e1a30bcc9 (diff)
Rename PointsToLocalMemory to PointsToLocalOrConstantMemory to make
the code more self-documenting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118171 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO/FunctionAttrs.cpp')
-rw-r--r--lib/Transforms/IPO/FunctionAttrs.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp
index 9e117daa68..d464e2ee82 100644
--- a/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -65,7 +65,7 @@ namespace {
CallGraphSCCPass::getAnalysisUsage(AU);
}
- bool PointsToLocalMemory(Value *V);
+ bool PointsToLocalOrConstantMemory(Value *V);
};
}
@@ -79,10 +79,10 @@ INITIALIZE_PASS_END(FunctionAttrs, "functionattrs",
Pass *llvm::createFunctionAttrsPass() { return new FunctionAttrs(); }
-/// PointsToLocalMemory - Returns whether the given pointer value points to
-/// memory that is local to the function. Global constants are considered
-/// local to all functions.
-bool FunctionAttrs::PointsToLocalMemory(Value *V) {
+/// PointsToLocalOrConstantMemory - Returns whether the given pointer value
+/// points to memory that is local to the function, with global constants being
+/// considered local to all functions.
+bool FunctionAttrs::PointsToLocalOrConstantMemory(Value *V) {
SmallVector<Value*, 16> Worklist;
unsigned MaxLookup = 8;
@@ -179,7 +179,8 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end();
CI != CE; ++CI) {
Value *Arg = *CI;
- if (Arg->getType()->isPointerTy() && !PointsToLocalMemory(Arg))
+ if (Arg->getType()->isPointerTy() &&
+ !PointsToLocalOrConstantMemory(Arg))
// Writes memory. Just give up.
return false;
}
@@ -188,11 +189,13 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
}
} else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
// Ignore non-volatile loads from local memory.
- if (!LI->isVolatile() && PointsToLocalMemory(LI->getPointerOperand()))
+ if (!LI->isVolatile() &&
+ PointsToLocalOrConstantMemory(LI->getPointerOperand()))
continue;
} else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
// Ignore non-volatile stores to local memory.
- if (!SI->isVolatile() && PointsToLocalMemory(SI->getPointerOperand()))
+ if (!SI->isVolatile() &&
+ PointsToLocalOrConstantMemory(SI->getPointerOperand()))
continue;
}