[llvm-commits] Patch for review: Speeding up ScheduleDAG computations

Evan Cheng evan.cheng at apple.com
Thu Feb 28 14:25:45 PST 2008

Hi Roman,

Thanks for doing this. It's been on my todo list forever. :-)

I have additional comments apart from Dan's comments.

+// Compute longest paths in the DAG
  void ScheduleDAG::CalculateDepths() {
LLVM convention is
/// CalculateDepths - Compute ...

+	WorkList.push_back(SU);
+    }
Please don't use tabs.

         Latencies[SU->NodeNum] = 1;
This should be 0, not 1 since the original code is:
     if (SU->Succs.empty())
       WorkList.push_back(std::make_pair(SU, 0U));

+	// If all dependencies of the node are processed already,

+      if(SuccLatency + SU->Latency > SULatency) {
Stylistic nitpick #1. Please make sure there is a space between if and  

+      unsigned Degree = --InDegree[SU->NodeNum];
+      if (Degree == 0)
Stylistic nitpick.
if (--InDegree[SU->NodeNum])

For testing, it would be good to run the original code and then the  
new code and then verify they produce the same numbers. A bug in  
depth / height calculation is not likely to cause correctness failures  
but something much more subtile.



On Feb 28, 2008, at 6:15 AM, Roman Levenstein wrote:

> Hi,
> I've implemented some improvements related to the computation of
> heights, depths and priorities and latencies of SUnits.
> The basic idea is that all these algorithms are computing the longest
> paths from the root node or to the exit node. Therefore I changed the
> existing implementation that uses and iterative and potentially
> exponential algorithm to a well-known graph algorithm based on dynamic
> programming. It has a linear run-time.
> Tests on very big  input files with tens of thousends of instructions
> in a BB, e.g. big4.bc use-case from Duraid's testsuit, indicate huge
> speed-ups (up to 2x) compared to the current version,
> Please review and tell if it is OK for submission.
> - Roman
> <ScheduleDAG.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

More information about the llvm-commits mailing list