[llvm] r203734 - Fix vectorizer docs.

Arnold Schwaighofer aschwaighofer at apple.com
Wed Mar 12 16:23:44 PDT 2014


Author: arnolds
Date: Wed Mar 12 18:23:44 2014
New Revision: 203734

URL: http://llvm.org/viewvc/llvm-project?rev=203734&view=rev
Log:
Fix vectorizer docs.

This example is not vectorized because LLVM does not prove no-wrapping of
"a[i*7] += ...".

Modified:
    llvm/trunk/docs/Vectorizers.rst

Modified: llvm/trunk/docs/Vectorizers.rst
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/Vectorizers.rst?rev=203734&r1=203733&r2=203734&view=diff
==============================================================================
--- llvm/trunk/docs/Vectorizers.rst (original)
+++ llvm/trunk/docs/Vectorizers.rst Wed Mar 12 18:23:44 2014
@@ -182,11 +182,14 @@ that scatter/gathers memory.
 
 .. code-block:: c++
 
-  int foo(int *A, int *B, int n, int k) {
-    for (int i = 0; i < n; ++i)
-      A[i*7] += B[i*k];
+  int foo(int * A, int * B, int n) {
+    for (intptr_t i = 0; i < n; ++i)
+        A[i] += B[i*4];
   }
 
+In many situations the cost model will inform LLVM that this is not beneficial
+and LLVM will only vectorize such code if forced with "-mllvm -force-vector-width=#".
+
 Vectorization of Mixed Types
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 





More information about the llvm-commits mailing list