summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit5d87f7d5f8471972063934f5cbe8c594e0ac30d3 (patch)
treef6e404ec4dd6d656a18971237389c6b0e855c6a3 /llvm/lib/CodeGen/BranchFolding.cpp
parentc85e9c563a18ee14af22aaafa904621408865fd1 (diff)
downloadbcm5719-llvm-5d87f7d5f8471972063934f5cbe8c594e0ac30d3.tar.gz
bcm5719-llvm-5d87f7d5f8471972063934f5cbe8c594e0ac30d3.zip
Add another statistic to measure code size due to tail duplication.
llvm-svn: 89254
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index e0a7825a26c..af5fbd1202a 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/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());
OpenPOWER on IntegriCloud