]> granicus.if.org Git - llvm/commitdiff
Revert last checkin. Note that PHI nodes can use basic blocks also!
authorChris Lattner <sabre@nondot.org>
Sat, 26 Apr 2003 17:38:26 +0000 (17:38 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 26 Apr 2003 17:38:26 +0000 (17:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5956 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Support/CFG.h

index e84f1db3ebc49de31b667a5814993bf2e57a7f90..aab0db9712b9f1aeefca7dd80dd148a64dd8e18c 100644 (file)
@@ -26,7 +26,14 @@ public:
   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 @@ public:
   
   inline _Self& operator++() {   // Preincrement
     assert(It != BB->use_end() && "pred_iterator out of range!");
-    ++It;
+    ++It; advancePastConstants();
     return *this; 
   }