[llvm-dev] Forcing loop optimization
Michael Kruse via llvm-dev
llvm-dev at lists.llvm.org
Tue Jun 15 10:02:44 PDT 2021
For forcing transformations via source code annotations, see [1].
However, there may be other reasons for an optimization to be not implied,
such as the loop not having been normalized. See [2]
[1]
https://clang.llvm.org/docs/LanguageExtensions.html#extensions-for-loop-hint-optimizations
[2] https://llvm.org/docs/LoopTerminology.html
Michael
Am Mo., 14. Juni 2021 um 08:23 Uhr schrieb Sudakshina Dutta via llvm-dev <
llvm-dev at lists.llvm.org>:
> Dear all,
>
> Good day to you. Is it possible to have forced application of loop
> unrolling or any other loop optimization ? I have tried applying loop
> unrolling on the following code. However, the optimization has not been
> applied by Clang.
>
> *Code (code.c)*
> int main()
> {
> int i1, i2, N;
> int In[50], A[50], D[50];
>
> N = 25;
> A[0] = In[0] + 5;
> #pragma clang loop unroll (enable)
> for(i1 = 1; i1 <= 25; i1++)
> {
> A[i1] = In[i1];
> D[i1] = A[i1];
> }
> return D[N];
> }
>
> *The applied commands*
>
> 1. clang -S -emit-llvm code.c -o code.ll -Xclang -disable-O0-optnon
> 2. opt -loop-unroll -S code.ll -o code-opt.ll -opt-bisect-limit=300
> -unroll-count=3 -print-after=loop-unroll
>
> Regards,
> Sudakshina
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://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/20210615/c567a6b7/attachment.html>
More information about the llvm-dev
mailing list