[PATCH] D13402: Refactor loop unrolling pass and add optimization remarks

hfinkel@anl.gov via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 27 21:38:00 PDT 2015


hfinkel added inline comments.

================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:283
@@ +282,3 @@
+    assert(LoopSize > 2 && "Loop size should be larger than 2");
+    return ((uint64_t)LoopSize - 2) * Count + 2;
+  }
----------------
There were comments explaining why 2 is subtracted:

  // When computing the unrolled size, note that the conditional branch on the
  // backedge and the comparison feeding it are not replicated like the rest of
  // the loop body (which is why 2 is subtracted).

please make sure these are transplanted with the calculation.


================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:1005
@@ -878,1 +1004,3 @@
     Count = UP.Count;
+    SetExplicitly = true;
+  }
----------------
Should we set SetExplicitly = true here? The comments say this is used to indicate a non-heuristically-chosen value. But this is a heuristically-chosen value, it just happens to have been chosen by the backend.



http://reviews.llvm.org/D13402





More information about the llvm-commits mailing list