[PATCH] Add optimization remarks to the loop unroller and vectorizer.

hfinkel at anl.gov hfinkel at anl.gov
Tue Apr 22 14:59:22 PDT 2014


Thanks for working on this!

================
Comment at: include/llvm/Analysis/LoopInfo.h:465
@@ +464,3 @@
+
+    // Try the pre-header first.
+    if ((HeadBB = getLoopPreheader()) != nullptr) {
----------------
Why are you looking in the pre-header first? That does not seem to make sense because the start of the preheader could be pretty far away from the start of the loop.

Maybe looking in the preheader makes sense, but you should specifically look for the *last* location somehow I'd think.

================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:242
@@ -234,1 +241,3 @@
+                               Twine("completely unrolled loop ") +
+                                   Twine(TripCount) + " times");
   } else {
----------------
This message should be improved. If I unroll a loop with 5 iterations, I've not unrolled it 5 times -- then I'd have 25 iterations ;)

How about: "completely unrolled loop with N iterations".

================
Comment at: lib/Transforms/Utils/LoopUnroll.cpp:246
@@ -236,2 +245,3 @@
           << " by " << Count);
+    Twine DiagMsg("unrolled loop " + Twine(Count) + " times ");
     if (TripMultiple == 0 || BreakoutTrip != TripMultiple) {
----------------
Here too, maybe something like: "unrolled loop by a factor of N"

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1194
@@ +1193,3 @@
+        Twine("vectorized loop. Vectorization factor: ") + Twine(VF.Width) +
+            ". Unroll factor: " + Twine(UF));
+
----------------
Sounds like we're calling this "interleaving factor". The capitalization seems odd here, nothing else is capitalized.

http://reviews.llvm.org/D3456

REPLY HANDLER ACTIONS
  Reply to comment, or !reject, !abandon, !reclaim, !resign, !rethink, !unsubscribe.






More information about the llvm-commits mailing list