summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-02-03 01:28:32 +0000
committerDan Gohman <gohman@apple.com>2009-02-03 01:28:32 +0000
commitfb306c0a10ecdaf6b4f5044b768b2470cd5af76e (patch)
treeb2f71c1faa13288de350018acaa74a0667464993
parenta814d961161e86a0023dfa29ab7814e1de2c85fe (diff)
downloadbcm5719-llvm-fb306c0a10ecdaf6b4f5044b768b2470cd5af76e.tar.gz
bcm5719-llvm-fb306c0a10ecdaf6b4f5044b768b2470cd5af76e.zip
Move isIdentifiedObject and isNoAliasCall into AliasAnalysis.cpp since
they are useful to analyses other than BasicAliasAnalysis.cpp. Include the full comment for isIdentifiedObject in the header file. Thanks to Chris for suggeseting this. llvm-svn: 63589
-rw-r--r--llvm/include/llvm/Analysis/AliasAnalysis.h10
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp24
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp24
3 files changed, 33 insertions, 25 deletions
diff --git a/llvm/include/llvm/Analysis/AliasAnalysis.h b/llvm/include/llvm/Analysis/AliasAnalysis.h
index 2beb8fb0bf1..1b38baf48c5 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysis.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysis.h
@@ -345,8 +345,16 @@ public:
}
};
+/// isNoAliasCall - Return true if this pointer is returned by a noalias
+/// function.
+bool isNoAliasCall(const Value *V);
+
/// isIdentifiedObject - Return true if this pointer refers to a distinct and
-/// identifiable object.
+/// identifiable object. This returns true for:
+/// Global Variables and Functions
+/// Allocas and Mallocs
+/// ByVal and NoAlias Arguments
+/// NoAlias returns
///
bool isIdentifiedObject(const Value *V);
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index c8c43a69ef7..d5de2fe616a 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -207,6 +207,30 @@ bool AliasAnalysis::canInstructionRangeModify(const Instruction &I1,
return false;
}
+/// isNoAliasCall - Return true if this pointer is returned by a noalias
+/// function.
+bool llvm::isNoAliasCall(const Value *V) {
+ if (isa<CallInst>(V) || isa<InvokeInst>(V))
+ return CallSite(const_cast<Instruction*>(cast<Instruction>(V)))
+ .paramHasAttr(0, Attribute::NoAlias);
+ return false;
+}
+
+/// isIdentifiedObject - Return true if this pointer refers to a distinct and
+/// identifiable object. This returns true for:
+/// Global Variables and Functions
+/// Allocas and Mallocs
+/// ByVal and NoAlias Arguments
+/// NoAlias returns
+///
+bool llvm::isIdentifiedObject(const Value *V) {
+ if (isa<GlobalValue>(V) || isa<AllocationInst>(V) || isNoAliasCall(V))
+ return true;
+ if (const Argument *A = dyn_cast<Argument>(V))
+ return A->hasNoAliasAttr() || A->hasByValAttr();
+ return false;
+}
+
// Because of the way .a files work, we must force the BasicAA implementation to
// be pulled in if the AliasAnalysis classes are pulled in. Otherwise we run
// the risk of AliasAnalysis being used, but the default implementation not
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 1002868e84c..ccbe338585d 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -64,30 +64,6 @@ static const Value *GetGEPOperands(const Value *V,
return V;
}
-/// isNoAliasCall - Return true if this pointer is returned by a noalias
-/// function.
-static bool isNoAliasCall(const Value *V) {
- if (isa<CallInst>(V) || isa<InvokeInst>(V))
- return CallSite(const_cast<Instruction*>(cast<Instruction>(V)))
- .paramHasAttr(0, Attribute::NoAlias);
- return false;
-}
-
-/// isIdentifiedObject - Return true if this pointer refers to a distinct and
-/// identifiable object. This returns true for:
-/// Global Variables and Functions
-/// Allocas and Mallocs
-/// ByVal and NoAlias Arguments
-/// NoAlias returns
-///
-bool llvm::isIdentifiedObject(const Value *V) {
- if (isa<GlobalValue>(V) || isa<AllocationInst>(V) || isNoAliasCall(V))
- return true;
- if (const Argument *A = dyn_cast<Argument>(V))
- return A->hasNoAliasAttr() || A->hasByValAttr();
- return false;
-}
-
/// isKnownNonNull - Return true if we know that the specified value is never
/// null.
static bool isKnownNonNull(const Value *V) {
OpenPOWER on IntegriCloud