summaryrefslogtreecommitdiff
path: root/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2009-11-18 22:12:31 +0000
committerBob Wilson <bob.wilson@apple.com>2009-11-18 22:12:31 +0000
commit79d621035ebe620261dd8139a0882f62edabbfdb (patch)
tree93a05ea6d7cc779191f507245c8550144bf9dc68 /lib/CodeGen/BranchFolding.cpp
parentf605773869d1489dcfb10c47f99ada9fe4908b45 (diff)
downloadllvm-79d621035ebe620261dd8139a0882f62edabbfdb.tar.gz
llvm-79d621035ebe620261dd8139a0882f62edabbfdb.tar.bz2
llvm-79d621035ebe620261dd8139a0882f62edabbfdb.tar.xz
Add another statistic to measure code size due to tail duplication.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89254 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/BranchFolding.cpp')
-rw-r--r--lib/CodeGen/BranchFolding.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/CodeGen/BranchFolding.cpp b/lib/CodeGen/BranchFolding.cpp
index e0a7825a26..af5fbd1202 100644
--- a/lib/CodeGen/BranchFolding.cpp
+++ b/lib/CodeGen/BranchFolding.cpp
@@ -42,6 +42,7 @@ STATISTIC(NumDeadBlocks, "Number of dead blocks removed");
STATISTIC(NumBranchOpts, "Number of branches optimized");
STATISTIC(NumTailMerge , "Number of block tails merged");
STATISTIC(NumTailDups , "Number of tail duplicated blocks");
+STATISTIC(NumInstrDups , "Additional instructions due to tail duplication");
static cl::opt<cl::boolOrDefault> FlagEnableTailMerge("enable-tail-merge",
cl::init(cl::BOU_UNSET), cl::Hidden);
@@ -1020,6 +1021,7 @@ bool BranchFolder::TailDuplicateBlocks(MachineFunction &MF) {
// If it is dead, remove it.
if (MBB->pred_empty()) {
+ NumInstrDups -= MBB->size();
RemoveDeadBlock(MBB);
MadeChange = true;
++NumDeadBlocks;
@@ -1100,6 +1102,7 @@ bool BranchFolder::TailDuplicate(MachineBasicBlock *TailBB,
MachineInstr *NewMI = MF.CloneMachineInstr(I);
PredBB->insert(PredBB->end(), NewMI);
}
+ NumInstrDups += TailBB->size() - 1; // subtract one for removed branch
// Update the CFG.
PredBB->removeSuccessor(PredBB->succ_begin());