[llvm-dev] unable to vectorize copy statement

Craig Topper via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 10 17:01:15 PST 2017


Nothing uses the array after the loop and the program exits after that.
Thus the compiler optimized out the loop because the computation was
unnecessary. It had not affect on the observable behavior of the program.

~Craig

On Fri, Nov 10, 2017 at 1:24 PM, hameeza ahmed <hahmed2305 at gmail.com> wrote:

> Hello,
> I am trying to vectorize copy statement in LLVM but unable to do so why?
> my code is follows:
>
> int main()
>
> {
>
> int c[2048], a[2048];
>
> for (int j=0; j<2048; j++)
>
>   { a[j]=2;
>   c[j] = a[j];
>
> }
> }
>
> the command is follows:
> opt  -S -O3 -force-vector-width=64 s.ll -o s_o3.ll
>
> how to do this?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171110/886a8a32/attachment.html>


More information about the llvm-dev mailing list