aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/LoopInfo.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-04-18 22:45:27 +0000
committerChris Lattner <sabre@nondot.org>2004-04-18 22:45:27 +0000
commit85661d0978dbbe678bc51f4e470149cb58f680f8 (patch)
tree4680c8ef1331b7cdcf2ad22bad061468a860e786 /lib/Analysis/LoopInfo.cpp
parent88d3ef2c744db0289223a4477669f24d542e6d97 (diff)
downloadexternal_llvm-85661d0978dbbe678bc51f4e470149cb58f680f8.zip
external_llvm-85661d0978dbbe678bc51f4e470149cb58f680f8.tar.gz
external_llvm-85661d0978dbbe678bc51f4e470149cb58f680f8.tar.bz2
Add new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/LoopInfo.cpp')
-rw-r--r--lib/Analysis/LoopInfo.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp
index 270a142..181cae0 100644
--- a/lib/Analysis/LoopInfo.cpp
+++ b/lib/Analysis/LoopInfo.cpp
@@ -56,6 +56,14 @@ unsigned Loop::getNumBackEdges() const {
return NumBackEdges;
}
+/// isLoopInvariant - Return true if the specified value is loop invariant
+///
+bool Loop::isLoopInvariant(Value *V) const {
+ if (Instruction *I = dyn_cast<Instruction>(V))
+ return !contains(I->getParent());
+ return true; // All non-instructions are loop invariant
+}
+
void Loop::print(std::ostream &OS, unsigned Depth) const {
OS << std::string(Depth*2, ' ') << "Loop Containing: ";