Hi, You might want to try running -loops -loop-simplify before loop unroll.>From loop simplify.cppThis pass performs several transformations to transform natural loops into a00011 // simpler form, which makes subsequent analyses and transformations simpler and00012 // more effective. Arushi On Tue, May 3, 2011 at 2:17 PM, Manish Gupta <mgupta.iitr at gmail.com> wrote:> You mean like > > *llvm-gcc-4.2 -O2 -emit-llvm Hello.c -c -o Hello.bc* > > But still i am not able to observe any effect on bit code by running > > *opt-2.8 -loop-unroll Hello.bc -o Hello_unroll.bc* > > On Tue, May 3, 2011 at 3:58 AM, Zakk <zakk0610 at gmail.com> wrote: > >> Hi, you need to run some optimization passes first. (like -O2) >> >> 2011/5/3 Manish Gupta <mgupta.iitr at gmail.com> >> >>> I just want to try loop-unroll and see corresponding changes in the >>> bitcode file. For that any loop will do. Have you been able to test llvm >>> loop-unroll successfully? >>> >>> >>> On Mon, May 2, 2011 at 10:04 PM, Yuan Pengfei <coolypf at qq.com> wrote: >>> >>>> Hi, >>>> >>>> > The loop that I am trying it on is: >>>> > for(i=0; i< 1000; i++) >>>> > { >>>> > c[i] = a[i] + b[i]; >>>> > } >>>> >>>> I can't find any benefit unrolling this loop. >>>> >>>> ------------------ >>>> Yuan Pengfei >>>> Peking Unversity, China >>> >>> >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>> >>> >> >> >> -- >> Best regards, >> Kuan-Hsu >> >> >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110503/fb4e882a/attachment.html>
We are looking for some LLVM compiler engineers for our GPU compiler team. Those positions involve both compiler feature development and optimizations on LLVM. Please contact me at czhang at qualcomm.com<mailto:czhang at qualcomm.com> if you are interested. Here is a link with more details of the job description: https://jobs.qualcomm.com/public/jobDetails.xhtml?requisitionId=1878327&page=jobSearch. Chihong Zhang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110503/2fe3f115/attachment.html>
Even after all the sequence of commands below bit-code is not showing any effect of loop-unrolling *manish at manish:~/Test2$ llvm-gcc-4.2 -O2 -emit-llvm Hello.c -c -o Hello.bc* *manish at manish:~/Test2$ opt-2.8 -loops Hello.bc -o Hello1.bc* *manish at manish:~/Test2$ opt-2.8 -loopsimplify Hello1.bc -o Hello2.bc* *manish at manish:~/Test2$ opt-2.8 -indvars Hello2.bc -o Hello3.bc* *manish at manish:~/Test2$ opt-2.8 -loop-unroll Hello3.bc -o Hello4.bc* *manish at manish:~/Test2$ llvm-dis-2.8 Hello4.bc* My *Hello.c* looks like: for(i=0; i< 1000; i++) { c[i] = a[i] + b[i]; } printf("%d\n", c[999]); ------------------------------------------------- and bit-code in *Hello4.bc* bb3: ; preds = %bb3, %bb3.preheader %i.17 = phi i32 [ %5, %bb3 ], [ 0, %bb3.preheader ] %scevgep11 = getelementptr [1000 x i32]* %b, i32 0, i32 %i.17 %scevgep10 = getelementptr [1000 x i32]* %a, i32 0, i32 %i.17 %scevgep = getelementptr [1000 x i32]* %c, i32 0, i32 %i.17 %2 = load i32* %scevgep10, align 4 %3 = load i32* %scevgep11, align 4 %4 = add nsw i32 %3, %2 store i32 %4, i32* %scevgep, align 4 %5 = add nsw i32 %i.17, 1 %exitcond1 = icmp eq i32 %5, 1000 br i1 %exitcond1, label %bb5, label %bb3 ----------------------------------------- On Tue, May 3, 2011 at 12:32 PM, Arushi Aggarwal <arushi987 at gmail.com>wrote:> Hi, > > You might want to try running -loops -loop-simplify before loop unroll. > > From loop simplify.cpp > > This pass performs several transformations to transform natural loops into a00011 // simpler form, which makes subsequent analyses and transformations simpler and00012 // more effective. > > > Arushi > > On Tue, May 3, 2011 at 2:17 PM, Manish Gupta <mgupta.iitr at gmail.com>wrote: > >> You mean like >> >> *llvm-gcc-4.2 -O2 -emit-llvm Hello.c -c -o Hello.bc* >> >> But still i am not able to observe any effect on bit code by running >> >> *opt-2.8 -loop-unroll Hello.bc -o Hello_unroll.bc* >> >> On Tue, May 3, 2011 at 3:58 AM, Zakk <zakk0610 at gmail.com> wrote: >> >>> Hi, you need to run some optimization passes first. (like -O2) >>> >>> 2011/5/3 Manish Gupta <mgupta.iitr at gmail.com> >>> >>>> I just want to try loop-unroll and see corresponding changes in the >>>> bitcode file. For that any loop will do. Have you been able to test llvm >>>> loop-unroll successfully? >>>> >>>> >>>> On Mon, May 2, 2011 at 10:04 PM, Yuan Pengfei <coolypf at qq.com> wrote: >>>> >>>>> Hi, >>>>> >>>>> > The loop that I am trying it on is: >>>>> > for(i=0; i< 1000; i++) >>>>> > { >>>>> > c[i] = a[i] + b[i]; >>>>> > } >>>>> >>>>> I can't find any benefit unrolling this loop. >>>>> >>>>> ------------------ >>>>> Yuan Pengfei >>>>> Peking Unversity, China >>>> >>>> >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>>> >>>> >>> >>> >>> -- >>> Best regards, >>> Kuan-Hsu >>> >>> >>> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110503/f7404dd5/attachment.html>
1. You should run the passes in the same opt command, for passes like loops which is an analysis pass provides results to the following passes. 2. You can pass a -debug flag to opt to see the some debugging info. 3. I tried this opt -mem2reg -loops -loopsimplify -loop-unroll -unroll-count=3 -debug loop.o -o tt.bc and got this message. Loop Size = 14 Can't unroll; loop not terminated by a conditional branch. 4. Looking at LoopUnroll.cpp showed a comment that said -loop-rotate helps, so I used the following opt -mem2reg -loops -loopsimplify -loop-rotate -lcssa -loop-unroll -unroll-count=3 -debug loop.o -o tt.bc Getting an unrolled version of the loop. Arushi On Tue, May 3, 2011 at 6:50 PM, Manish Gupta <mgupta.iitr at gmail.com> wrote:> Even after all the sequence of commands below bit-code is not showing any > effect of loop-unrolling > > *manish at manish:~/Test2$ llvm-gcc-4.2 -O2 -emit-llvm Hello.c -c -o Hello.bc > * > *manish at manish:~/Test2$ opt-2.8 -loops Hello.bc -o Hello1.bc* > *manish at manish:~/Test2$ opt-2.8 -loopsimplify Hello1.bc -o Hello2.bc* > *manish at manish:~/Test2$ opt-2.8 -indvars Hello2.bc -o Hello3.bc* > *manish at manish:~/Test2$ opt-2.8 -loop-unroll Hello3.bc -o Hello4.bc* > *manish at manish:~/Test2$ llvm-dis-2.8 Hello4.bc* > > My *Hello.c* looks like: > for(i=0; i< 1000; i++) > { > c[i] = a[i] + b[i]; > } > > printf("%d\n", c[999]); > ------------------------------------------------- > > and bit-code in *Hello4.bc* > bb3: ; preds = %bb3, > %bb3.preheader > %i.17 = phi i32 [ %5, %bb3 ], [ 0, %bb3.preheader ] > %scevgep11 = getelementptr [1000 x i32]* %b, i32 0, i32 %i.17 > %scevgep10 = getelementptr [1000 x i32]* %a, i32 0, i32 %i.17 > %scevgep = getelementptr [1000 x i32]* %c, i32 0, i32 %i.17 > %2 = load i32* %scevgep10, align 4 > %3 = load i32* %scevgep11, align 4 > %4 = add nsw i32 %3, %2 > store i32 %4, i32* %scevgep, align 4 > %5 = add nsw i32 %i.17, 1 > %exitcond1 = icmp eq i32 %5, 1000 > br i1 %exitcond1, label %bb5, label %bb3 > > ----------------------------------------- > > On Tue, May 3, 2011 at 12:32 PM, Arushi Aggarwal <arushi987 at gmail.com>wrote: > >> Hi, >> >> You might want to try running -loops -loop-simplify before loop unroll. >> >> From loop simplify.cpp >> >> This pass performs several transformations to transform natural loops into a00011 // simpler form, which makes subsequent analyses and transformations simpler and00012 // more effective. >> >> >> Arushi >> >> On Tue, May 3, 2011 at 2:17 PM, Manish Gupta <mgupta.iitr at gmail.com>wrote: >> >>> You mean like >>> >>> *llvm-gcc-4.2 -O2 -emit-llvm Hello.c -c -o Hello.bc* >>> >>> But still i am not able to observe any effect on bit code by running >>> >>> *opt-2.8 -loop-unroll Hello.bc -o Hello_unroll.bc* >>> >>> On Tue, May 3, 2011 at 3:58 AM, Zakk <zakk0610 at gmail.com> wrote: >>> >>>> Hi, you need to run some optimization passes first. (like -O2) >>>> >>>> 2011/5/3 Manish Gupta <mgupta.iitr at gmail.com> >>>> >>>>> I just want to try loop-unroll and see corresponding changes in the >>>>> bitcode file. For that any loop will do. Have you been able to test llvm >>>>> loop-unroll successfully? >>>>> >>>>> >>>>> On Mon, May 2, 2011 at 10:04 PM, Yuan Pengfei <coolypf at qq.com> wrote: >>>>> >>>>>> Hi, >>>>>> >>>>>> > The loop that I am trying it on is: >>>>>> > for(i=0; i< 1000; i++) >>>>>> > { >>>>>> > c[i] = a[i] + b[i]; >>>>>> > } >>>>>> >>>>>> I can't find any benefit unrolling this loop. >>>>>> >>>>>> ------------------ >>>>>> Yuan Pengfei >>>>>> Peking Unversity, China >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> LLVM Developers mailing list >>>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>>>> >>>>> >>>> >>>> >>>> -- >>>> Best regards, >>>> Kuan-Hsu >>>> >>>> >>>> >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>> >>> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110503/7e0b4a9b/attachment.html>