diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-04-18 22:45:27 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-04-18 22:45:27 +0000 |
| commit | 26ba2f5fe8c86ad23d65fd4b84d241e063fba780 (patch) | |
| tree | da8a189ab0fdc49e1569cd398ba35be1a3a79921 /llvm/lib/Analysis | |
| parent | d4d66c86c0c509b15032dc2595a2d78530694bae (diff) | |
| download | bcm5719-llvm-26ba2f5fe8c86ad23d65fd4b84d241e063fba780.tar.gz bcm5719-llvm-26ba2f5fe8c86ad23d65fd4b84d241e063fba780.zip | |
Add new method
llvm-svn: 13050
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/LoopInfo.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/LoopInfo.cpp b/llvm/lib/Analysis/LoopInfo.cpp index 270a142ad2d..181cae0ab07 100644 --- a/llvm/lib/Analysis/LoopInfo.cpp +++ b/llvm/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: "; |

