When we code extract some stuff, leave the codeRepl block in the place where
authorChris Lattner <sabre@nondot.org>
Fri, 13 Aug 2004 03:17:39 +0000 (03:17 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 13 Aug 2004 03:17:39 +0000 (03:17 +0000)
the extracted code was, instead of putting it at the end of the function

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15716 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/CodeExtractor.cpp

index b3de38a5db3a41d763f765cf40dd002594f60371..4521038dd660ce735fa0917917e3baaa6a65bbbf 100644 (file)
@@ -622,7 +622,7 @@ ExtractCodeRegion(const std::vector<BasicBlock*> &code) {
   Function *oldFunction = header->getParent();
 
   // This takes place of the original loop
-  BasicBlock *codeReplacer = new BasicBlock("codeRepl", oldFunction);
+  BasicBlock *codeReplacer = new BasicBlock("codeRepl", oldFunction, header);
 
   // The new function needs a root node because other nodes can branch to the
   // head of the region, but the entry node of a function cannot have preds.