[llvm-commits] CVS: llvm/include/llvm/Support/CFG.h

Chris Lattner lattner at cs.uiuc.edu
Sat Apr 26 12:39:01 PDT 2003


Changes in directory llvm/include/llvm/Support:

CFG.h updated: 1.9 -> 1.10

---
Log message:

Revert last checkin.  Note that PHI nodes can use basic blocks also!


---
Diffs of the changes:

Index: llvm/include/llvm/Support/CFG.h
diff -u llvm/include/llvm/Support/CFG.h:1.9 llvm/include/llvm/Support/CFG.h:1.10
--- llvm/include/llvm/Support/CFG.h:1.9	Fri Apr 25 18:39:08 2003
+++ llvm/include/llvm/Support/CFG.h	Sat Apr 26 12:38:26 2003
@@ -26,7 +26,14 @@
   typedef PredIterator<_Ptr,_USE_iterator> _Self;
   typedef typename super::pointer pointer;
   
+  inline void advancePastConstants() {
+    // Loop to ignore non terminator uses (for example PHI nodes)...
+    while (It != BB->use_end() && !isa<TerminatorInst>(*It))
+      ++It;
+  }
+  
   inline PredIterator(_Ptr *bb) : BB(bb), It(bb->use_begin()) {
+    advancePastConstants();
   }
   inline PredIterator(_Ptr *bb, bool) : BB(bb), It(bb->use_end()) {}
     
@@ -41,7 +48,7 @@
   
   inline _Self& operator++() {   // Preincrement
     assert(It != BB->use_end() && "pred_iterator out of range!");
-    ++It;
+    ++It; advancePastConstants();
     return *this; 
   }
   





More information about the llvm-commits mailing list