diff options
| author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:11:02 +0000 | 
|---|---|---|
| committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:11:02 +0000 | 
| commit | d7f7719e5e082c0b8ea2182dcbd2242b7834aa26 (patch) | |
| tree | 70fbd90da02177c8e6ef82adba9fa8ace285a5e3 /lib/CodeGen/BranchFolding.cpp | |
| parent | 9f4a1da9a0a56a0b0a7f8249f34b3cdea6179c41 (diff) | |
Notes
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
| -rw-r--r-- | lib/CodeGen/BranchFolding.cpp | 29 | 
1 files changed, 5 insertions, 24 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp index 8f519407ccd4e..9dec22ec78a36 100644 --- a/lib/CodeGen/BranchFolding.cpp +++ b/lib/CodeGen/BranchFolding.cpp @@ -264,14 +264,8 @@ static unsigned HashMachineInstr(const MachineInstr *MI) {    return Hash;  } -/// HashEndOfMBB - Hash the last few instructions in the MBB.  For blocks -/// with no successors, we hash two instructions, because cross-jumping -/// only saves code when at least two instructions are removed (since a -/// branch must be inserted).  For blocks with a successor, one of the -/// two blocks to be tail-merged will end with a branch already, so -/// it gains to cross-jump even for one instruction. -static unsigned HashEndOfMBB(const MachineBasicBlock *MBB, -                             unsigned minCommonTailLength) { +/// HashEndOfMBB - Hash the last instruction in the MBB. +static unsigned HashEndOfMBB(const MachineBasicBlock *MBB) {    MachineBasicBlock::const_iterator I = MBB->end();    if (I == MBB->begin())      return 0;   // Empty MBB. @@ -283,20 +277,8 @@ static unsigned HashEndOfMBB(const MachineBasicBlock *MBB,        return 0;      // MBB empty except for debug info.      --I;    } -  unsigned Hash = HashMachineInstr(I); -  if (I == MBB->begin() || minCommonTailLength == 1) -    return Hash;   // Single instr MBB. - -  --I; -  while (I->isDebugValue()) { -    if (I==MBB->begin()) -      return Hash;      // MBB with single non-debug instr. -    --I; -  } -  // Hash in the second-to-last instruction. -  Hash ^= HashMachineInstr(I) << 2; -  return Hash; +  return HashMachineInstr(I);  }  /// ComputeCommonTailLength - Given two machine basic blocks, compute the number @@ -811,7 +793,7 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {    MergePotentials.clear();    for (MachineFunction::iterator I = MF.begin(), E = MF.end(); I != E; ++I) {      if (I->succ_empty()) -      MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(I, 2U), I)); +      MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(I), I));    }    // See if we can do any tail merging on those. @@ -897,8 +879,7 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {                // reinsert conditional branch only, for now                TII->InsertBranch(*PBB, (TBB == IBB) ? FBB : TBB, 0, NewCond);            } -          MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(PBB, 1U), -                                                       *P)); +          MergePotentials.push_back(MergePotentialsElt(HashEndOfMBB(PBB), *P));          }        }        if (MergePotentials.size() >= 2)  | 
