aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Support/CFG.h
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-04-26 17:38:26 +0000
committerChris Lattner <sabre@nondot.org>2003-04-26 17:38:26 +0000
commit6ad5a31324125d7fd91ef791fac3c29657d0f825 (patch)
tree2b20364847b151196b193536a1ace5dee72b42e9 /include/llvm/Support/CFG.h
parent90117cbb6f9e6bd10361e6d81e890f5cfc7b4a87 (diff)
downloadexternal_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.h9
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;
}