diff options
Diffstat (limited to 'lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | lib/Transforms/Utils/SimplifyCFG.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Transforms/Utils/SimplifyCFG.cpp b/lib/Transforms/Utils/SimplifyCFG.cpp index 86d4a7508c..6c14a643e8 100644 --- a/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1789,6 +1789,13 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { Instruction *NewRet = RI->clone(); Pred->getInstList().push_back(NewRet); + BasicBlock::iterator BBI = RI; + if (BBI != BB->begin()) { + // Move region end info into the predecessor. + if (DbgRegionEndInst *DREI = dyn_cast<DbgRegionEndInst>(--BBI)) + DREI->moveBefore(NewRet); + } + // If the return instruction returns a value, and if the value was a // PHI node in "BB", propagate the right value into the return. for (User::op_iterator i = NewRet->op_begin(), e = NewRet->op_end(); @@ -1806,7 +1813,7 @@ bool llvm::SimplifyCFG(BasicBlock *BB) { // If we eliminated all predecessors of the block, delete the block now. if (pred_begin(BB) == pred_end(BB)) // We know there are no successors, so just nuke the block. - DeleteDeadBlock(BB); + M->getBasicBlockList().erase(BB); return true; } |