diff options
author | Chris Lattner <sabre@nondot.org> | 2003-04-26 17:38:26 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2003-04-26 17:38:26 +0000 |
commit | 6ad5a31324125d7fd91ef791fac3c29657d0f825 (patch) | |
tree | 2b20364847b151196b193536a1ace5dee72b42e9 /include/llvm/Support/CFG.h | |
parent | 90117cbb6f9e6bd10361e6d81e890f5cfc7b4a87 (diff) | |
download | external_llvm-6ad5a31324125d7fd91ef791fac3c29657d0f825.tar.gz external_llvm-6ad5a31324125d7fd91ef791fac3c29657d0f825.tar.bz2 external_llvm-6ad5a31324125d7fd91ef791fac3c29657d0f825.zip |
Revert last checkin. Note that PHI nodes can use basic blocks also!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5956 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/CFG.h')
-rw-r--r-- | include/llvm/Support/CFG.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/llvm/Support/CFG.h b/include/llvm/Support/CFG.h index e84f1db3eb..aab0db9712 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<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; } |