[llvm-commits] [llvm] r46790 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

2008-02-05 Thread Tanya Lattner
Author: tbrethou
Date: Tue Feb  5 18:54:55 2008
New Revision: 46790

URL: http://llvm.org/viewvc/llvm-project?rev=46790view=rev
Log:
Throttle the non-local dependence analysis for basic blocks with more than 50 
predecessors. Added command line option to play with this threshold.

Modified:
llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=46790r1=46789r2=46790view=diff

==
--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Tue Feb  5 18:54:55 
2008
@@ -20,6 +20,7 @@
 #include llvm/Function.h
 #include llvm/Analysis/AliasAnalysis.h
 #include llvm/Support/CFG.h
+#include llvm/Support/CommandLine.h
 #include llvm/Target/TargetData.h
 #include llvm/ADT/Statistic.h
 
@@ -27,6 +28,15 @@
 
 using namespace llvm;
 
+namespace {
+  // Control the calculation of non-local dependencies by only examining the
+  // predecessors if the basic block has less than X amount (50 by default).
+  cl::optint 
+  PredLimit(nonlocaldep-threshold, cl::Hidden, cl::init(50),
+cl::desc(Control the calculation of non-local
+ dependencies (default = 50)));   
+}
+
 STATISTIC(NumCacheNonlocal, Number of cached non-local responses);
 STATISTIC(NumUncacheNonlocal, Number of uncached non-local responses);
 
@@ -211,15 +221,18 @@
 }
 
 // If we didn't find anything, recurse on the precessors of this block
+// Only do this for blocks with a small number of predecessors.
 bool predOnStack = false;
 bool inserted = false;
-for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB);
- PI != PE; ++PI)
-  if (!visited.count(*PI)) {
-stack.push_back(*PI);
-inserted = true;
-  } else
-predOnStack = true;
+if (std::distance(pred_begin(BB), pred_end(BB)) = PredLimit) { 
+  for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB);
+   PI != PE; ++PI)
+if (!visited.count(*PI)) {
+  stack.push_back(*PI);
+  inserted = true;
+} else
+  predOnStack = true;
+}
 
 // If we inserted a new predecessor, then we'll come back to this block
 if (inserted)


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r46790 - /llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

2008-02-05 Thread Owen Anderson

Wow, that must be one hell of a CFG you're dealing with. ;-)

--Owen

On Feb 5, 2008, at 6:54 PM, Tanya Lattner wrote:


Author: tbrethou
Date: Tue Feb  5 18:54:55 2008
New Revision: 46790

URL: http://llvm.org/viewvc/llvm-project?rev=46790view=rev
Log:
Throttle the non-local dependence analysis for basic blocks with  
more than 50 predecessors. Added command line option to play with  
this threshold.


Modified:
   llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp

Modified: llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp?rev=46790r1=46789r2=46790view=diff

= 
= 
= 
= 
= 
= 
= 
= 
==

--- llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/MemoryDependenceAnalysis.cpp Tue Feb  5  
18:54:55 2008

@@ -20,6 +20,7 @@
#include llvm/Function.h
#include llvm/Analysis/AliasAnalysis.h
#include llvm/Support/CFG.h
+#include llvm/Support/CommandLine.h
#include llvm/Target/TargetData.h
#include llvm/ADT/Statistic.h

@@ -27,6 +28,15 @@

using namespace llvm;

+namespace {
+  // Control the calculation of non-local dependencies by only  
examining the
+  // predecessors if the basic block has less than X amount (50 by  
default).

+  cl::optint
+  PredLimit(nonlocaldep-threshold, cl::Hidden, cl::init(50),
+cl::desc(Control the calculation of non-local
+ dependencies (default = 50)));
+}
+
STATISTIC(NumCacheNonlocal, Number of cached non-local responses);
STATISTIC(NumUncacheNonlocal, Number of uncached non-local  
responses);


@@ -211,15 +221,18 @@
}

// If we didn't find anything, recurse on the precessors of this  
block

+// Only do this for blocks with a small number of predecessors.
bool predOnStack = false;
bool inserted = false;
-for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB);
- PI != PE; ++PI)
-  if (!visited.count(*PI)) {
-stack.push_back(*PI);
-inserted = true;
-  } else
-predOnStack = true;
+if (std::distance(pred_begin(BB), pred_end(BB)) = PredLimit) {
+  for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB);
+   PI != PE; ++PI)
+if (!visited.count(*PI)) {
+  stack.push_back(*PI);
+  inserted = true;
+} else
+  predOnStack = true;
+}

// If we inserted a new predecessor, then we'll come back to  
this block

if (inserted)


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




smime.p7s
Description: S/MIME cryptographic signature
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits