[polly] r287968 - [ScopDetectionDiagnostic] Collect statistics for each diagnostic type
Tobias Grosser via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 25 21:53:10 PST 2016
Author: grosser
Date: Fri Nov 25 23:53:09 2016
New Revision: 287968
URL: http://llvm.org/viewvc/llvm-project?rev=287968&view=rev
Log:
[ScopDetectionDiagnostic] Collect statistics for each diagnostic type
Our original statistics were added before we introduced a more fine-grained
diagnostic system, but the granularity of our statistics has never been
increased accordingly. This change introduces now one statistic counter per
diagnostic to enable us to collect fine-grained statistics about who certain
scops are not detected. In case coarser grained statistics are needed, the
user is expected to combine counters manually.
Modified:
polly/trunk/include/polly/ScopDetectionDiagnostic.h
polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp
polly/trunk/test/ScopInfo/Alias-0.ll
polly/trunk/test/ScopInfo/Alias-1.ll
polly/trunk/test/ScopInfo/Alias-2.ll
polly/trunk/test/ScopInfo/Alias-3.ll
polly/trunk/test/ScopInfo/Alias-4.ll
Modified: polly/trunk/include/polly/ScopDetectionDiagnostic.h
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/include/polly/ScopDetectionDiagnostic.h?rev=287968&r1=287967&r2=287968&view=diff
==============================================================================
--- polly/trunk/include/polly/ScopDetectionDiagnostic.h (original)
+++ polly/trunk/include/polly/ScopDetectionDiagnostic.h Fri Nov 25 23:53:09 2016
@@ -117,7 +117,7 @@ protected:
public:
RejectReasonKind getKind() const { return Kind; }
- RejectReason(RejectReasonKind K) : Kind(K) {}
+ RejectReason(RejectReasonKind K);
virtual ~RejectReason() {}
Modified: polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp?rev=287968&r1=287967&r2=287968&view=diff
==============================================================================
--- polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp (original)
+++ polly/trunk/lib/Analysis/ScopDetectionDiagnostic.cpp Fri Nov 25 23:53:09 2016
@@ -38,15 +38,36 @@
using namespace llvm;
-#define BADSCOP_STAT(NAME, DESC) \
- STATISTIC(Bad##NAME##ForScop, "Number of bad regions for Scop: " DESC)
+#define SCOP_STAT(NAME, DESC) \
+ { "polly-detect", "NAME", "Number of rejected regions: " DESC, {0}, false }
-BADSCOP_STAT(CFG, "CFG too complex");
-BADSCOP_STAT(LoopBound, "Loop bounds can not be computed");
-BADSCOP_STAT(FuncCall, "Function call with side effects appeared");
-BADSCOP_STAT(AffFunc, "Expression not affine");
-BADSCOP_STAT(Alias, "Found base address alias");
-BADSCOP_STAT(Other, "Others");
+llvm::Statistic RejectStatistics[] = {
+ SCOP_STAT(CFG, ""),
+ SCOP_STAT(InvalidTerminator, "Unsupported terminator instruction"),
+ SCOP_STAT(IrreducibleRegion, "Irreducible loops"), SCOP_STAT(LastCFG, ""),
+ SCOP_STAT(AffFunc, ""), SCOP_STAT(UndefCond, "Undefined branch condition"),
+ SCOP_STAT(InvalidCond, "Non-integer branch condition"),
+ SCOP_STAT(UndefOperand, "Undefined operands in comparison"),
+ SCOP_STAT(NonAffBranch, "Non-affine branch condition"),
+ SCOP_STAT(NoBasePtr, "No base pointer"),
+ SCOP_STAT(UndefBasePtr, "Undefined base pointer"),
+ SCOP_STAT(VariantBasePtr, "Variant base pointer"),
+ SCOP_STAT(NonAffineAccess, "Non-affine memory accesses"),
+ SCOP_STAT(DifferentElementSize, "Accesses with differing sizes"),
+ SCOP_STAT(LastAffFunc, ""),
+ SCOP_STAT(LoopBound, "Uncomputable loop bounds"),
+ SCOP_STAT(LoopHasNoExit, "Loop without exit"),
+ SCOP_STAT(FuncCall, "Function call with side effects"),
+ SCOP_STAT(NonSimpleMemoryAccess,
+ "Compilated access semantics (volatile or atomic)"),
+ SCOP_STAT(Alias, "Base address aliasing"), SCOP_STAT(Other, ""),
+ SCOP_STAT(IntToPtr, "Integer to pointer conversions"),
+ SCOP_STAT(Alloca, "Stack allocations"),
+ SCOP_STAT(UnknownInst, "Unknown Instructions"),
+ SCOP_STAT(Entry, "Contains entry block"),
+ SCOP_STAT(Unprofitable, "Assumed to be unprofitable"),
+ SCOP_STAT(LastOther, ""),
+};
namespace polly {
/// Small string conversion via raw_string_stream.
@@ -118,6 +139,11 @@ void emitRejectionRemarks(const BBPair &
//===----------------------------------------------------------------------===//
// RejectReason.
+
+RejectReason::RejectReason(RejectReasonKind K) : Kind(K) {
+ RejectStatistics[static_cast<int>(K)]++;
+}
+
const DebugLoc RejectReason::Unknown = DebugLoc();
const llvm::DebugLoc &RejectReason::getDebugLoc() const {
@@ -135,9 +161,7 @@ void RejectLog::print(raw_ostream &OS, i
//===----------------------------------------------------------------------===//
// ReportCFG.
-ReportCFG::ReportCFG(const RejectReasonKind K) : RejectReason(K) {
- ++BadCFGForScop;
-}
+ReportCFG::ReportCFG(const RejectReasonKind K) : RejectReason(K) {}
bool ReportCFG::classof(const RejectReason *RR) {
return RR->getKind() >= RejectReasonKind::CFG &&
@@ -180,9 +204,7 @@ bool ReportIrreducibleRegion::classof(co
// ReportAffFunc.
ReportAffFunc::ReportAffFunc(const RejectReasonKind K, const Instruction *Inst)
- : RejectReason(K), Inst(Inst) {
- ++BadAffFuncForScop;
-}
+ : RejectReason(K), Inst(Inst) {}
bool ReportAffFunc::classof(const RejectReason *RR) {
return RR->getKind() >= RejectReasonKind::AffFunc &&
@@ -310,9 +332,7 @@ std::string ReportNonAffineAccess::getEn
ReportLoopBound::ReportLoopBound(Loop *L, const SCEV *LoopCount)
: RejectReason(RejectReasonKind::LoopBound), L(L), LoopCount(LoopCount),
- Loc(L->getStartLoc()) {
- ++BadLoopBoundForScop;
-}
+ Loc(L->getStartLoc()) {}
std::string ReportLoopBound::getMessage() const {
return "Non affine loop bound '" + *LoopCount + "' in loop: " +
@@ -350,9 +370,7 @@ std::string ReportLoopHasNoExit::getEndU
// ReportFuncCall.
ReportFuncCall::ReportFuncCall(Instruction *Inst)
- : RejectReason(RejectReasonKind::FuncCall), Inst(Inst) {
- ++BadFuncCallForScop;
-}
+ : RejectReason(RejectReasonKind::FuncCall), Inst(Inst) {}
std::string ReportFuncCall::getMessage() const {
return "Call instruction: " + *Inst;
@@ -402,8 +420,6 @@ ReportAlias::ReportAlias(Instruction *In
for (const auto &I : AS)
Pointers.push_back(I.getValue());
-
- ++BadAliasForScop;
}
std::string ReportAlias::formatInvalidAlias(std::string Prefix,
@@ -457,9 +473,7 @@ bool ReportAlias::classof(const RejectRe
std::string ReportOther::getMessage() const { return "Unknown reject reason"; }
-ReportOther::ReportOther(const RejectReasonKind K) : RejectReason(K) {
- ++BadOtherForScop;
-}
+ReportOther::ReportOther(const RejectReasonKind K) : RejectReason(K) {}
bool ReportOther::classof(const RejectReason *RR) {
return RR->getKind() >= RejectReasonKind::Other &&
Modified: polly/trunk/test/ScopInfo/Alias-0.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/Alias-0.ll?rev=287968&r1=287967&r2=287968&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/Alias-0.ll (original)
+++ polly/trunk/test/ScopInfo/Alias-0.ll Fri Nov 25 23:53:09 2016
@@ -33,4 +33,4 @@ declare i32 @rnd(...)
; RTA: 1 polly-detect - Number of regions that a valid part of Scop
-; NORTA: 1 polly-detect - Number of bad regions for Scop: Found base address alias
+; NORTA: 1 polly-detect - Number of rejected regions: Base address aliasing
Modified: polly/trunk/test/ScopInfo/Alias-1.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/Alias-1.ll?rev=287968&r1=287967&r2=287968&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/Alias-1.ll (original)
+++ polly/trunk/test/ScopInfo/Alias-1.ll Fri Nov 25 23:53:09 2016
@@ -34,4 +34,4 @@ declare i32 @rnd(...)
; RTA: 1 polly-detect - Number of regions that a valid part of Scop
-; NORTA: 1 polly-detect - Number of bad regions for Scop: Found base address alias
+; NORTA: 1 polly-detect - Number of rejected regions: Base address aliasing
Modified: polly/trunk/test/ScopInfo/Alias-2.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/Alias-2.ll?rev=287968&r1=287967&r2=287968&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/Alias-2.ll (original)
+++ polly/trunk/test/ScopInfo/Alias-2.ll Fri Nov 25 23:53:09 2016
@@ -32,4 +32,4 @@ return:
}
; RTA: 1 polly-detect - Number of regions that a valid part of Scop
-; NORTA: 1 polly-detect - Number of bad regions for Scop: Found base address alias
+; NORTA: 1 polly-detect - Number of rejected regions: Base address aliasing
Modified: polly/trunk/test/ScopInfo/Alias-3.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/Alias-3.ll?rev=287968&r1=287967&r2=287968&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/Alias-3.ll (original)
+++ polly/trunk/test/ScopInfo/Alias-3.ll Fri Nov 25 23:53:09 2016
@@ -25,4 +25,4 @@ return:
; RTA: 1 polly-detect - Number of regions that a valid part of Scop
-; NORTA: 1 polly-detect - Number of bad regions for Scop: Found base address alias
+; NORTA: 1 polly-detect - Number of rejected regions: Base address aliasing
Modified: polly/trunk/test/ScopInfo/Alias-4.ll
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/test/ScopInfo/Alias-4.ll?rev=287968&r1=287967&r2=287968&view=diff
==============================================================================
--- polly/trunk/test/ScopInfo/Alias-4.ll (original)
+++ polly/trunk/test/ScopInfo/Alias-4.ll Fri Nov 25 23:53:09 2016
@@ -25,4 +25,4 @@ return:
; RTA: 1 polly-detect - Number of regions that a valid part of Scop
-; NORTA: 1 polly-detect - Number of bad regions for Scop: Found base address alias
+; NORTA: 1 polly-detect - Number of rejected regions: Base address aliasing
More information about the llvm-commits
mailing list