diff --git a/lib/Transforms/Utils/CodeExtractor.cpp b/lib/Transforms/Utils/CodeExtractor.cpp index 38f3c8a4c66..530d2f66b73 100644 --- a/lib/Transforms/Utils/CodeExtractor.cpp +++ b/lib/Transforms/Utils/CodeExtractor.cpp @@ -566,8 +566,18 @@ Function *CodeExtractor::ExtractCodeRegion(const std::vector &code) return newFunction; } +/// ExtractBasicBlock - slurp a natural loop into a brand new function +/// Function* llvm::ExtractLoop(Loop *L) { CodeExtractor CE; return CE.ExtractCodeRegion(L->getBlocks()); } +/// ExtractBasicBlock - slurp a basic block into a brand new function +/// +Function* llvm::ExtractBasicBlock(BasicBlock *BB) { + CodeExtractor CE; + std::vector Blocks; + Blocks.push_back(BB); + return CE.ExtractCodeRegion(Blocks); +}