[PATCH] D45209: [LoopInterchange] Add stats counter for number of interchanged loops.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 4 02:25:52 PDT 2018
fhahn updated this revision to Diff 140917.
fhahn added a comment.
rebased
https://reviews.llvm.org/D45209
Files:
lib/Transforms/Scalar/LoopInterchange.cpp
test/Transforms/LoopInterchange/interchange-no-deps.ll
Index: test/Transforms/LoopInterchange/interchange-no-deps.ll
===================================================================
--- test/Transforms/LoopInterchange/interchange-no-deps.ll
+++ test/Transforms/LoopInterchange/interchange-no-deps.ll
@@ -1,5 +1,6 @@
; RUN: opt < %s -loop-interchange -simplifycfg -pass-remarks-output=%t \
-; RUN: -pass-remarks=loop-interchange -pass-remarks-missed=loop-interchange -S
+; RUN: -pass-remarks=loop-interchange -pass-remarks-missed=loop-interchange -stats -S 2>&1 \
+; RUN: | FileCheck -check-prefix=STATS %s
; RUN: FileCheck -input-file %t %s
@@ -87,3 +88,6 @@
exit: ; preds = %for1.inc
ret i32 0
}
+
+; Check stats, we interchanged 1 out of 3 loops.
+; STATS: 1 loop-interchange - Number of loops interchanged
Index: lib/Transforms/Scalar/LoopInterchange.cpp
===================================================================
--- lib/Transforms/Scalar/LoopInterchange.cpp
+++ lib/Transforms/Scalar/LoopInterchange.cpp
@@ -15,6 +15,7 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/DependenceAnalysis.h"
@@ -51,6 +52,8 @@
#define DEBUG_TYPE "loop-interchange"
+STATISTIC(LoopsInterchanged, "Number of loops interchanged");
+
static cl::opt<int> LoopInterchangeCostThreshold(
"loop-interchange-threshold", cl::init(0), cl::Hidden,
cl::desc("Interchange if you gain more than this number"));
@@ -613,6 +616,7 @@
LoopNestExit, LIL.hasInnerLoopReduction());
LIT.transform();
DEBUG(dbgs() << "Loops interchanged.\n");
+ LoopsInterchanged++;
return true;
}
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45209.140917.patch
Type: text/x-patch
Size: 1786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180404/d39e9cff/attachment.bin>
More information about the llvm-commits
mailing list