diff options
Diffstat (limited to 'llvm/lib/VMCore/BasicBlock.cpp')
-rw-r--r-- | llvm/lib/VMCore/BasicBlock.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/BasicBlock.cpp b/llvm/lib/VMCore/BasicBlock.cpp index 64711fea0c7..514aa1de237 100644 --- a/llvm/lib/VMCore/BasicBlock.cpp +++ b/llvm/lib/VMCore/BasicBlock.cpp @@ -15,6 +15,7 @@ #include "llvm/Constants.h" #include "llvm/Instructions.h" #include "llvm/Type.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/Support/CFG.h" #include "llvm/Support/LeakDetector.h" #include "llvm/Support/Compiler.h" @@ -260,7 +261,9 @@ BasicBlock *BasicBlock::splitBasicBlock(iterator I, const std::string &BBName) { assert(I != InstList.end() && "Trying to get me to create degenerate basic block!"); - BasicBlock *New = BasicBlock::Create(BBName, getParent(), getNext()); + BasicBlock *InsertBefore = next(Function::iterator(this)) + .getNodePtrUnchecked(); + BasicBlock *New = BasicBlock::Create(BBName, getParent(), InsertBefore); // Move all of the specified instructions from the original basic block into // the new basic block. |