1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 03:33:20 +01:00

Reprioritize tests for tail duplication to be aggressive about indirect

branches even when optimizing for code size.  Unless we find evidence to the
contrary in the future, the special treatment for indirect branches does not
have a significant effect on code size, and performance still matters with -Os.

llvm-svn: 90147
This commit is contained in:
Bob Wilson 2009-11-30 18:56:45 +00:00
parent b293fe32cb
commit a71b008477

View File

@ -116,14 +116,14 @@ bool TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB,
// duplicate only one, because one branch instruction can be eliminated to
// compensate for the duplication.
unsigned MaxDuplicateCount;
if (MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize))
MaxDuplicateCount = 1;
else if (!TailBB->empty() && TailBB->back().getDesc().isIndirectBranch())
if (!TailBB->empty() && TailBB->back().getDesc().isIndirectBranch())
// If the target has hardware branch prediction that can handle indirect
// branches, duplicating them can often make them predictable when there
// are common paths through the code. The limit needs to be high enough
// to allow undoing the effects of tail merging.
MaxDuplicateCount = 20;
else if (MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize))
MaxDuplicateCount = 1;
else
MaxDuplicateCount = TailDuplicateSize;