diff options
author | Stephen Hines <srhines@google.com> | 2015-04-01 18:49:24 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-04-01 18:49:26 +0000 |
commit | 3fa16bd6062e23bcdb82ed4dd965674792e6b761 (patch) | |
tree | 9348fc507292f7e8715d22d64ce5a32131b4f875 /lib/IR/BasicBlock.cpp | |
parent | beed47390a60f6f0c77532b3d3f76bb47ef49423 (diff) | |
parent | ebe69fe11e48d322045d5949c83283927a0d790b (diff) | |
download | external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.zip external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.tar.gz external_llvm-3fa16bd6062e23bcdb82ed4dd965674792e6b761.tar.bz2 |
Merge "Update aosp/master LLVM for rebase to r230699."
Diffstat (limited to 'lib/IR/BasicBlock.cpp')
-rw-r--r-- | lib/IR/BasicBlock.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/lib/IR/BasicBlock.cpp b/lib/IR/BasicBlock.cpp index 5ed9bed..b3b3cbf 100644 --- a/lib/IR/BasicBlock.cpp +++ b/lib/IR/BasicBlock.cpp @@ -19,7 +19,6 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/IntrinsicInst.h" #include "llvm/IR/LLVMContext.h" -#include "llvm/IR/LeakDetector.h" #include "llvm/IR/Type.h" #include <algorithm> using namespace llvm; @@ -47,9 +46,6 @@ BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent, BasicBlock *InsertBefore) : Value(Type::getLabelTy(C), Value::BasicBlockVal), Parent(nullptr) { - // Make sure that we get added to a function - LeakDetector::addGarbageObject(this); - if (NewParent) insertInto(NewParent, InsertBefore); else @@ -94,14 +90,8 @@ BasicBlock::~BasicBlock() { } void BasicBlock::setParent(Function *parent) { - if (getParent()) - LeakDetector::addGarbageObject(this); - // Set Parent=parent, updating instruction symtab entries as appropriate. InstList.setSymTabObject(&Parent, parent); - - if (getParent()) - LeakDetector::removeGarbageObject(this); } void BasicBlock::removeFromParent() { @@ -249,6 +239,20 @@ BasicBlock *BasicBlock::getUniquePredecessor() { return PredBB; } +BasicBlock *BasicBlock::getUniqueSuccessor() { + succ_iterator SI = succ_begin(this), E = succ_end(this); + if (SI == E) return NULL; // No successors + BasicBlock *SuccBB = *SI; + ++SI; + for (;SI != E; ++SI) { + if (*SI != SuccBB) + return NULL; + // The same successor appears multiple times in the successor list. + // This is OK. + } + return SuccBB; +} + /// removePredecessor - This method is used to notify a BasicBlock that the /// specified Predecessor of the block is no longer able to reach it. This is /// actually not used to update the Predecessor list, but is actually used to |