aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-11-30 18:56:45 +0000
committerBob Wilson <bob.wilson@apple.com>2009-11-30 18:56:45 +0000
commit3858225afc2a7f1027dce34dc72de5686b636c2d (patch)
tree98b17b027c1ff77cb9e1c10c9c63a4c090593b5a /lib/CodeGen
parent15217e63bce6c161b355b63d6496c7c327d15817 (diff)
downloadexternal_llvm-3858225afc2a7f1027dce34dc72de5686b636c2d.zip
external_llvm-3858225afc2a7f1027dce34dc72de5686b636c2d.tar.gz
external_llvm-3858225afc2a7f1027dce34dc72de5686b636c2d.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90147 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/TailDuplication.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/CodeGen/TailDuplication.cpp b/lib/CodeGen/TailDuplication.cpp
index 68fa209..9c0b596 100644
--- a/lib/CodeGen/TailDuplication.cpp
+++ b/lib/CodeGen/TailDuplication.cpp
@@ -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;