[llvm-commits] CVS: llvm/lib/Analysis/LoopInfo.cpp

Chris Lattner lattner at cs.uiuc.edu
Sun Apr 18 17:46:15 PDT 2004


Changes in directory llvm/lib/Analysis:

LoopInfo.cpp updated: 1.53 -> 1.54

---
Log message:

Add new method


---
Diffs of the changes:  (+8 -0)

Index: llvm/lib/Analysis/LoopInfo.cpp
diff -u llvm/lib/Analysis/LoopInfo.cpp:1.53 llvm/lib/Analysis/LoopInfo.cpp:1.54
--- llvm/lib/Analysis/LoopInfo.cpp:1.53	Sun Apr 18 17:21:41 2004
+++ llvm/lib/Analysis/LoopInfo.cpp	Sun Apr 18 17:45:27 2004
@@ -56,6 +56,14 @@
   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: ";
 





More information about the llvm-commits mailing list