[llvm-commits] [llvm] r161783 - /llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
Jakob Stoklund Olesen
stoklund at 2pi.dk
Mon Aug 13 14:03:27 PDT 2012
Author: stoklund
Date: Mon Aug 13 16:03:27 2012
New Revision: 161783
URL: http://llvm.org/viewvc/llvm-project?rev=161783&view=rev
Log:
Count triangles and diamonds in early if-conversion.
Modified:
llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
Modified: llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp?rev=161783&r1=161782&r2=161783&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp (original)
+++ llvm/trunk/lib/CodeGen/EarlyIfConversion.cpp Mon Aug 13 16:03:27 2012
@@ -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 @@
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 @@
if (!findInsertionPoint())
return false;
+ if (isTriangle())
+ ++NumTrianglesSeen;
+ else
+ ++NumDiamondsSeen;
return true;
}
@@ -499,6 +509,12 @@
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());
More information about the llvm-commits
mailing list