OSDN Git Service

[NFC] Collect statistics in GuardWidening
authorMax Kazantsev <max.kazantsev@azul.com>
Tue, 31 Jul 2018 04:37:11 +0000 (04:37 +0000)
committerMax Kazantsev <max.kazantsev@azul.com>
Tue, 31 Jul 2018 04:37:11 +0000 (04:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338348 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/GuardWidening.cpp

index b939ef3..055fcbc 100644 (file)
@@ -43,6 +43,7 @@
 #include <functional>
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/DepthFirstIterator.h"
+#include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/LoopInfo.h"
 #include "llvm/Analysis/LoopPass.h"
 #include "llvm/Analysis/PostDominators.h"
@@ -61,6 +62,8 @@ using namespace llvm;
 
 #define DEBUG_TYPE "guard-widening"
 
+STATISTIC(GuardsEliminated, "Number of eliminated guards");
+
 namespace {
 
 class GuardWideningImpl {
@@ -362,6 +365,7 @@ bool GuardWideningImpl::isGuard(const Instruction* I) {
 
 void GuardWideningImpl::eliminateGuard(Instruction *GuardInst) {
   GuardInst->eraseFromParent();
+  ++GuardsEliminated;
 }
 
 GuardWideningImpl::WideningScore GuardWideningImpl::computeWideningScore(