[PATCH] Generate Loop Fusion Statistics

Johannes Doerfert doerfert at cs.uni-saarland.de
Tue Oct 28 16:58:34 PDT 2014


Some comments. Also take a look at http://reviews.llvm.org/D5283 and if that isn't good reuse the test cases.

================
Comment at: lib/Transform/ScheduleOptimizer.cpp:618
@@ +617,3 @@
+  ScatPMA = isl_pw_multi_aff_gist(ScatPMA, Stmt->getDomain());
+  ScatPA  = isl_pw_multi_aff_get_pw_aff(ScatPMA, D);
+
----------------
Extract this (see below)

================
Comment at: lib/Transform/ScheduleOptimizer.cpp:634
@@ +633,3 @@
+  ScatPMA = isl_pw_multi_aff_gist(ScatPMA, Stmt->getDomain());
+  ScatPA  = isl_pw_multi_aff_get_pw_aff(ScatPMA, D);
+
----------------
Extract this (see above)

================
Comment at: lib/Transform/ScheduleOptimizer.cpp:696
@@ +695,3 @@
+    if (!doesScatteringInvolveInputDims(*Begin, D))
+      continue;
+
----------------
Move that in the begin loop:

void f(int *restrict A, int *restrict B) {
  int i, j;
  for (i = 0; i < 10; i++)
    B[i] = 0;

  for (i = 0; i < 1024; i++) {
    for (j = 0; j < 1024; j++)
      A[i+j] ^= 4;
    for (j = 0; j < 1024; j++)
      A[i+j] ^= 4;
  }


================
Comment at: lib/Transform/ScheduleOptimizer.cpp:706
@@ +705,3 @@
+      unsigned LoopDimension = getOutermostLoopDim(*I, D);
+      assert(LoopDimension >= 0 && "Expected positive loop dimension");
+
----------------
This should produce a warning: unsigned >= 0 is always true

================
Comment at: lib/Transform/ScheduleOptimizer.cpp:708
@@ +707,3 @@
+
+      const Loop *LoopI = (*I)->getLoopForDimension(LoopDimension);
+
----------------
This can crash, not every stmt has loop dimension loops surrounding it.

http://reviews.llvm.org/D5908






More information about the llvm-commits mailing list