[PATCH] D32729: LV: Don't vectorize with unknown loop counts on divergent targets

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 2 11:16:03 PDT 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:5224
+                    "dynamic loop count for divergent target\n");
+    return false;
+  }
----------------
The comment here needs a bit more detail.  Even if the trip count isn't uniform, as long as it isn't tiny, vectorizing still reduces the total number of instructions executed.  For example, if you're vectorizing a simple f32 loop to <4 x f32>, the main loop executes "maxTripCount/4" times, and the remainder loop executes at most 3 times.  Assuming maxTripCount is large, maxTripCount/4 + 3 is much smaller than maxTripCount.


https://reviews.llvm.org/D32729





More information about the llvm-commits mailing list