From 97c9c552185a455fea55f0fe3078bb0cb12cb8f3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 26 Apr 2003 17:38:26 +0000 Subject: [PATCH] Revert last checkin. Note that PHI nodes can use basic blocks also! llvm-svn: 5956 --- include/llvm/Support/CFG.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/llvm/Support/CFG.h b/include/llvm/Support/CFG.h index e84f1db3ebc..aab0db9712b 100644 --- a/include/llvm/Support/CFG.h +++ b/include/llvm/Support/CFG.h @@ -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(*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; }