[PATCH] Add a stat to show how often the MaxLookupSearchDepth limit is hit

Wei Mi wmi at google.com
Mon May 11 16:50:03 PDT 2015


Hi hfinkel, qcolombet,

As http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20150413/271370.html described, GEP depth can directly affect the precision of BasicAA. Add a statistic use to count how often we hit the limit.

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D9689

Files:
  lib/Analysis/BasicAliasAnalysis.cpp

Index: lib/Analysis/BasicAliasAnalysis.cpp
===================================================================
--- lib/Analysis/BasicAliasAnalysis.cpp
+++ lib/Analysis/BasicAliasAnalysis.cpp
@@ -16,6 +16,7 @@
 #include "llvm/Analysis/Passes.h"
 #include "llvm/ADT/SmallPtrSet.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Statistic.h"
 #include "llvm/Analysis/AliasAnalysis.h"
 #include "llvm/Analysis/AssumptionCache.h"
 #include "llvm/Analysis/CFG.h"
@@ -42,6 +43,14 @@
 #include <algorithm>
 using namespace llvm;
 
+/// SearchLimitReached / SearchTimes shows how often the limit of
+/// MaxLookupSearchDepth is hit. It will affect the precision
+/// of basic alias analysis.
+#define DEBUG_TYPE "basicaa"
+STATISTIC(SearchLimitReached, "Number of times the limit of "
+                              "MaxLookupSearchDepth is reached");
+STATISTIC(SearchTimes, "Number of times the gep expression is searched")
+
 /// Cutoff after which to stop analysing a set of phi nodes potentially involved
 /// in a cycle. Because we are analysing 'through' phi nodes we need to be
 /// careful with value equivalence. We use reachability to make sure a value
@@ -297,6 +306,7 @@
   // Limit recursion depth to limit compile time in crazy cases.
   unsigned MaxLookup = MaxLookupSearchDepth;
   MaxLookupReached = false;
+  SearchTimes++;
 
   BaseOffs = 0;
   do {
@@ -416,6 +426,7 @@
 
   // If the chain of expressions is too deep, just return early.
   MaxLookupReached = true;
+  SearchLimitReached++;
   return V;
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9689.25528.patch
Type: text/x-patch
Size: 1528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150511/a6603098/attachment.bin>


More information about the llvm-commits mailing list