From edcfeaeb8e6b38087d5740bd20dadd5546bf31fd Mon Sep 17 00:00:00 2001 From: Fedor Sergeev Date: Wed, 17 Oct 2018 09:02:54 +0000 Subject: [PATCH] [LoopPredication] add some simple stats Just adding some useful statistics to LoopPredication pass which was lacking any of these. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@344681 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LoopPredication.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/Transforms/Scalar/LoopPredication.cpp b/lib/Transforms/Scalar/LoopPredication.cpp index cbb6594cf8f..ccaf10142d5 100644 --- a/lib/Transforms/Scalar/LoopPredication.cpp +++ b/lib/Transforms/Scalar/LoopPredication.cpp @@ -178,6 +178,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Transforms/Scalar/LoopPredication.h" +#include "llvm/ADT/Statistic.h" #include "llvm/Analysis/BranchProbabilityInfo.h" #include "llvm/Analysis/LoopInfo.h" #include "llvm/Analysis/LoopPass.h" @@ -196,6 +197,9 @@ #define DEBUG_TYPE "loop-predication" +STATISTIC(TotalConsidered, "Number of guards considered"); +STATISTIC(TotalWidened, "Number of checks widened"); + using namespace llvm; static cl::opt EnableIVTruncation("loop-predication-enable-iv-truncation", @@ -574,6 +578,8 @@ bool LoopPredication::widenGuardConditions(IntrinsicInst *Guard, LLVM_DEBUG(dbgs() << "Processing guard:\n"); LLVM_DEBUG(Guard->dump()); + TotalConsidered++; + IRBuilder<> Builder(cast(Preheader->getTerminator())); // The guard condition is expected to be in form of: @@ -615,6 +621,8 @@ bool LoopPredication::widenGuardConditions(IntrinsicInst *Guard, if (NumWidened == 0) return false; + TotalWidened += NumWidened; + // Emit the new guard condition Builder.SetInsertPoint(Guard); Value *LastCheck = nullptr; -- 2.11.0