[llvm-dev] m32 flag disables vectorization
Michael Zolotukhin via llvm-dev
llvm-dev at lists.llvm.org
Fri Jul 7 10:02:59 PDT 2017
Hi,
I’d recommend using pass-remarks (add -pass-remarks=loop-vectorize to your opt invocation) - it might give some hints.
Michael
PS: For me it’s vectorized independently on using -m32:
> bin/clang -emit-llvm -c -O0 1.c -o - | bin/opt -mem2reg -loops -loop-simplify -loop-rotate -loop-vectorize -o /dev/null -pass-remarks=loop-vectorize
remark: <unknown>:0:0: vectorized loop (vectorization width: 4, interleaved count: 2)
remark: <unknown>:0:0: vectorized loop (vectorization width: 4, interleaved count: 2)
> bin/clang -emit-llvm -m32 -c -O0 1.c -o - | bin/opt -mem2reg -loops -loop-simplify -loop-rotate -loop-vectorize -o /dev/null -pass-remarks=loop-vectorize
remark: <unknown>:0:0: vectorized loop (vectorization width: 4, interleaved count: 2)
remark: <unknown>:0:0: vectorized loop (vectorization width: 4, interleaved count: 2)
> bin/clang -v
clang version 4.0.0 (trunk 278549) (llvm/trunk 278569)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
> On Jul 7, 2017, at 9:16 AM, Anastasiya Ruzhanskaya via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Hello,
>
> I have a simple loop,
> #include <stdio.h>
> #define N 200
>
> int array[N];
>
> int main() {
> int result = 0;
> int a, b, c;
> for (b = 0; b < N; b++)
> array[b] = b%3;
>
> #pragma clang loop vectorize(enable)
> for (a = 0; a < N; a++) {
> result += array[a];
> }
>
> return result;
> }
>
>
> I compile it like this:
> clang -emit-llvm -m32 -c -O0 myarray2.c -o myarray2.s
> opt -mem2reg -loops -loop-simplify -loop-rotate -loop-vectorize -S myarray2.s -o opt.s
>
> and I don't see any effect of vectorization. When I delete m32 flag, vectorization is applied, Why does this happen?
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170707/7e7f827f/attachment-0001.html>
More information about the llvm-dev
mailing list