mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-25 14:32:53 +00:00
PR1909: Tail merging pass ran wild. It makes no sense to merge blocks in order to save a single instruction since a branch will be inserted for each BB.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47301 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
422cba6ed0
commit
31886dbe37
@ -451,7 +451,10 @@ static bool MergeCompare(const std::pair<unsigned,MachineBasicBlock*> &p,
|
|||||||
|
|
||||||
bool BranchFolder::TryMergeBlocks(MachineBasicBlock *SuccBB,
|
bool BranchFolder::TryMergeBlocks(MachineBasicBlock *SuccBB,
|
||||||
MachineBasicBlock* PredBB) {
|
MachineBasicBlock* PredBB) {
|
||||||
unsigned minCommonTailLength = (SuccBB ? 1 : 2);
|
// It doesn't make sense to save a single instruction since tail merging
|
||||||
|
// will add a jump.
|
||||||
|
// FIXME: Ask the target to provide the threshold?
|
||||||
|
unsigned minCommonTailLength = (SuccBB ? 1 : 2) + 1;
|
||||||
MadeChange = false;
|
MadeChange = false;
|
||||||
|
|
||||||
// Sort by hash value so that blocks with identical end sequences sort
|
// Sort by hash value so that blocks with identical end sequences sort
|
||||||
@ -541,6 +544,12 @@ bool BranchFolder::TryMergeBlocks(MachineBasicBlock *SuccBB,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MachineBasicBlock::iterator TrialBBI1, TrialBBI2;
|
||||||
|
unsigned CommonTailLen = ComputeCommonTailLength(CurMBB, MBB2,
|
||||||
|
TrialBBI1, TrialBBI2);
|
||||||
|
if (CommonTailLen < minCommonTailLength)
|
||||||
|
continue;
|
||||||
|
|
||||||
// Decide whether we want to split CurMBB or MBB2.
|
// Decide whether we want to split CurMBB or MBB2.
|
||||||
if (ShouldSplitFirstBlock(CurMBB, BBI1, MBB2, BBI2, PredBB)) {
|
if (ShouldSplitFirstBlock(CurMBB, BBI1, MBB2, BBI2, PredBB)) {
|
||||||
CurMBB = SplitMBBAt(*CurMBB, BBI1);
|
CurMBB = SplitMBBAt(*CurMBB, BBI1);
|
||||||
|
Loading…
Reference in New Issue
Block a user