[PATCH] [Patch] Loop Interchange Pass

hfinkel at anl.gov hfinkel at anl.gov
Thu Feb 12 22:42:17 PST 2015


================
Comment at: lib/Transforms/Scalar/LoopInterchange.cpp:415
@@ +414,3 @@
+  // We currently handle only 1 induction variable inside the loop. We also do
+  // not handle reductions as of now.
+  for (auto I = innerLoopHeader->begin(), E = innerLoopHeader->end(); I != E;
----------------
karthikthecool wrote:
> hfinkel wrote:
> > How are you checking for reductions here? Do you need to check that the one PHI you've found is not used outside of the loop?
> We are currently checking if there is only 1 PHI node in the lop header which will corrospond to the induction variable. If we find any other PHI's either due to reductions or triangular loop structure. We currently exit as  current limiation.
No, I mean uses outside of the loops in general. I don't think you check for that. You check for:

  if (numUsageinLatch + numUsageinHeader != 1)
    return false;

but the PHI could be used in any block dominated by the loop. Do you need to check for that?

  int i, j;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      a[i][j] = 7;

  cout << "final i, j = " << i << ",  " << j << "\n";

http://reviews.llvm.org/D7499

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list