diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-06-23 09:09:15 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-06-23 09:09:15 +0000 |
commit | 95c3e48f9557adb6064d580684bb14cacec2f826 (patch) | |
tree | 377049dc513cb4332763e8da894cc3e7aa7ec72e /lib/VMCore/BasicBlock.cpp | |
parent | 5b46e8e6b82226810d0d6440b7b5fb05e68df5e8 (diff) | |
download | llvm-95c3e48f9557adb6064d580684bb14cacec2f826.tar.gz llvm-95c3e48f9557adb6064d580684bb14cacec2f826.tar.bz2 llvm-95c3e48f9557adb6064d580684bb14cacec2f826.tar.xz |
Reinstate r133513 (reverted in r133700) with an additional fix for a
-Wshorten-64-to-32 warning in Instructions.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133708 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | lib/VMCore/BasicBlock.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/VMCore/BasicBlock.cpp b/lib/VMCore/BasicBlock.cpp index 3f1a6a99b6..7d470440af 100644 --- a/lib/VMCore/BasicBlock.cpp +++ b/lib/VMCore/BasicBlock.cpp @@ -308,3 +308,19 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const Twine &BBName) { return New; } +void BasicBlock::replaceSuccessorsPhiUsesWith(BasicBlock *New) { + TerminatorInst *TI = getTerminator(); + if (!TI) + // Cope with being called on a BasicBlock that doesn't have a terminator + // yet. Clang's CodeGenFunction::EmitReturnBlock() likes to do this. + return; + for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) { + BasicBlock *Succ = TI->getSuccessor(i); + for (iterator II = Succ->begin(); PHINode *PN = dyn_cast<PHINode>(II); + ++II) { + int i; + while ((i = PN->getBasicBlockIndex(this)) >= 0) + PN->setIncomingBlock(i, New); + } + } +} |