[PATCH] D108644: [LoopFlatten] Add statistic for number of loops flattened. NFC
Rosie Sumpter via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 24 10:17:30 PDT 2021
RosieSumpter created this revision.
RosieSumpter added reviewers: dmgreen, SjoerdMeijer.
Herald added a subscriber: hiraditya.
RosieSumpter requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D108644
Files:
llvm/lib/Transforms/Scalar/LoopFlatten.cpp
Index: llvm/lib/Transforms/Scalar/LoopFlatten.cpp
===================================================================
--- llvm/lib/Transforms/Scalar/LoopFlatten.cpp
+++ llvm/lib/Transforms/Scalar/LoopFlatten.cpp
@@ -27,6 +27,8 @@
//===----------------------------------------------------------------------===//
#include "llvm/Transforms/Scalar/LoopFlatten.h"
+
+#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/OptimizationRemarkEmitter.h"
@@ -49,11 +51,13 @@
#include "llvm/Transforms/Utils/ScalarEvolutionExpander.h"
#include "llvm/Transforms/Utils/SimplifyIndVar.h"
-#define DEBUG_TYPE "loop-flatten"
-
using namespace llvm;
using namespace llvm::PatternMatch;
+#define DEBUG_TYPE "loop-flatten"
+
+STATISTIC(NumFlattened, "Number of loops flattened");
+
static cl::opt<unsigned> RepeatedInstructionThreshold(
"loop-flatten-cost-threshold", cl::Hidden, cl::init(2),
cl::desc("Limit on the cost of instructions that can be repeated due to "
@@ -630,6 +634,10 @@
SE->forgetLoop(FI.OuterLoop);
SE->forgetLoop(FI.InnerLoop);
LI->erase(FI.InnerLoop);
+
+ // Increment statistic value.
+ NumFlattened++;
+
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108644.368385.patch
Type: text/x-patch
Size: 1247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210824/20c2047a/attachment.bin>
More information about the llvm-commits
mailing list