mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-14 14:24:05 +00:00
Fix PR3138: if we merge the entry block into another block, make sure to
move the other block back up into the entry position! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60179 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -165,7 +165,13 @@ bool JumpThreading::ProcessBlock(BasicBlock *BB) {
|
||||
// predecessors of our predecessor block.
|
||||
if (BasicBlock *SinglePred = BB->getSinglePredecessor())
|
||||
if (SinglePred->getTerminator()->getNumSuccessors() == 1) {
|
||||
// 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(BB);
|
||||
|
||||
if (isEntry && BB != &BB->getParent()->getEntryBlock())
|
||||
BB->moveBefore(&BB->getParent()->getEntryBlock());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user