diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-08-13 21:03:27 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-08-13 21:03:27 +0000 |
commit | 786556c26847befdb011298fd7b36ae86fd150b0 (patch) | |
tree | 8e4090e3bb177b88a020cce46b1da00e2e348861 | |
parent | 5f6d36335b9468a16bd3b0c3ab8bab103841332a (diff) | |
download | external_llvm-786556c26847befdb011298fd7b36ae86fd150b0.zip external_llvm-786556c26847befdb011298fd7b36ae86fd150b0.tar.gz external_llvm-786556c26847befdb011298fd7b36ae86fd150b0.tar.bz2 |
Count triangles and diamonds in early if-conversion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161783 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/CodeGen/EarlyIfConversion.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/CodeGen/EarlyIfConversion.cpp b/lib/CodeGen/EarlyIfConversion.cpp index b533387..f9347ef 100644 --- a/lib/CodeGen/EarlyIfConversion.cpp +++ b/lib/CodeGen/EarlyIfConversion.cpp @@ -24,6 +24,7 @@ #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SparseSet.h" +#include "llvm/ADT/Statistic.h" #include "llvm/CodeGen/MachineBranchProbabilityInfo.h" #include "llvm/CodeGen/MachineDominators.h" #include "llvm/CodeGen/MachineFunction.h" @@ -50,6 +51,11 @@ BlockInstrLimit("early-ifcvt-limit", cl::init(30), cl::Hidden, static cl::opt<bool> Stress("stress-early-ifcvt", cl::Hidden, cl::desc("Turn all knobs to 11")); +STATISTIC(NumDiamondsSeen, "Number of diamonds"); +STATISTIC(NumDiamondsConv, "Number of diamonds converted"); +STATISTIC(NumTrianglesSeen, "Number of triangles"); +STATISTIC(NumTrianglesConv, "Number of triangles converted"); + //===----------------------------------------------------------------------===// // SSAIfConv //===----------------------------------------------------------------------===// @@ -434,6 +440,10 @@ bool SSAIfConv::canConvertIf(MachineBasicBlock *MBB) { if (!findInsertionPoint()) return false; + if (isTriangle()) + ++NumTrianglesSeen; + else + ++NumDiamondsSeen; return true; } @@ -499,6 +509,12 @@ void SSAIfConv::rewritePHIOperands() { void SSAIfConv::convertIf(SmallVectorImpl<MachineBasicBlock*> &RemovedBlocks) { assert(Head && Tail && TBB && FBB && "Call canConvertIf first."); + // Update statistics. + if (isTriangle()) + ++NumTrianglesConv; + else + ++NumDiamondsConv; + // Move all instructions into Head, except for the terminators. if (TBB != Tail) Head->splice(InsertionPoint, TBB, TBB->begin(), TBB->getFirstTerminator()); |