aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/CodeGen/MachineBasicBlock.h7
-rw-r--r--lib/CodeGen/MachineBasicBlock.cpp6
2 files changed, 7 insertions, 6 deletions
diff --git a/include/llvm/CodeGen/MachineBasicBlock.h b/include/llvm/CodeGen/MachineBasicBlock.h
index 62394cfc90..b3578584e6 100644
--- a/include/llvm/CodeGen/MachineBasicBlock.h
+++ b/include/llvm/CodeGen/MachineBasicBlock.h
@@ -217,12 +217,7 @@ public:
/// isSuccessor - Return true if the specified MBB is a successor of this
/// block.
- bool isSuccessor(MachineBasicBlock *MBB) const {
- for (const_succ_iterator I = succ_begin(), E = succ_end(); I != E; ++I)
- if (*I == MBB)
- return true;
- return false;
- }
+ bool isSuccessor(MachineBasicBlock *MBB) const;
/// getFirstTerminator - returns an iterator to the first terminator
/// instruction of this basic block. If a terminator does not exist,
diff --git a/lib/CodeGen/MachineBasicBlock.cpp b/lib/CodeGen/MachineBasicBlock.cpp
index 39780350de..44f7f90a65 100644
--- a/lib/CodeGen/MachineBasicBlock.cpp
+++ b/lib/CodeGen/MachineBasicBlock.cpp
@@ -192,3 +192,9 @@ void MachineBasicBlock::removePredecessor(MachineBasicBlock *pred) {
assert(I != Predecessors.end() && "Pred is not a predecessor of this block!");
Predecessors.erase(I);
}
+
+bool MachineBasicBlock::isSuccessor(MachineBasicBlock *MBB) const {
+ std::vector<MachineBasicBlock *>::const_iterator I =
+ std::find(Successors.begin(), Successors.end(), MBB);
+ return I != Successors.end();
+}