mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-10-19 11:02:59 +02:00
defensive patch: if CGP is merging a block with the entry block, make sure
it ends up being the entry block. llvm-svn: 60180
This commit is contained in:
parent
73b251b3bf
commit
8c052366b3
@ -204,8 +204,15 @@ void CodeGenPrepare::EliminateMostlyEmptyBlock(BasicBlock *BB) {
|
||||
|
||||
// If the destination block has a single pred, then this is a trivial edge,
|
||||
// just collapse it.
|
||||
if (DestBB->getSinglePredecessor()) {
|
||||
if (BasicBlock *SinglePred = DestBB->getSinglePredecessor()) {
|
||||
// Remember if SinglePred was the entry block of the function. If so, we
|
||||
// will need to move BB back to the entry position.
|
||||
bool isEntry = SinglePred == &SinglePred->getParent()->getEntryBlock();
|
||||
MergeBasicBlockIntoOnlyPred(DestBB);
|
||||
|
||||
if (isEntry && BB != &BB->getParent()->getEntryBlock())
|
||||
BB->moveBefore(&BB->getParent()->getEntryBlock());
|
||||
|
||||
DOUT << "AFTER:\n" << *DestBB << "\n\n\n";
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user