[LLVMdev] problem with loopinfo
Chris Lattner
sabre at nondot.org
Thu Jun 15 16:03:12 PDT 2006
On Thu, 15 Jun 2006, Wei Jiang wrote:
> I did run the indvars pass, but it seemed that it didn't work.
Then you'll have to trace through and find out why it's failing...
-Chris
> ----- Original Message ----- From: "Chris Lattner" <sabre at nondot.org>
> To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
> Sent: Thursday, June 15, 2006 3:35 PM
> Subject: Re: [LLVMdev] problem with loopinfo
>
>
>> On Thu, 15 Jun 2006, Wei Jiang wrote:
>>> hi,
>>> The loopinfo pass failed to recognize the Tripcount of a simple program
>>> constructed by me, can you help me to figure out why this happened?
>>> Thanks.
>>> The C program and corresponding .ll files are shown below. I used
>>> llvm1.7 to develop my own pass, and want to use the loop information.
>>
>> What passes are you running before your pass? trip count information is
>> generally only available after the "indvars" pass runs.
>>
>> -Chris
>>
>>> Test.c:
>>> #include "stdio.h"
>>> #define N 40
>>> void func1() {
>>> int a[N];
>>> int i,j;
>>> for (i=0; i<N; i++) {
>>> if (i==0)
>>> a[i] = i*N;
>>> else
>>> a[i] = i*i;
>>> }
>>> }
>>>
>>> Test.ll:
>>> void %func1() {
>>> entry:
>>> %a = alloca [40 x int] ; <[40 x int]*> [#uses=1]
>>> br label %no_exit
>>>
>>> no_exit: ; preds = %else, %then, %entry
>>> %i.0.0 = phi int [ 0, %entry ], [ %inc9, %then ], [ %inc, %else ] ;
>>> <int> [#uses=7]
>>> %tmp.4 = seteq int %i.0.0, 0 ; <bool> [#uses=1]
>>> %tmp.7 = getelementptr [40 x int]* %a, int 0, int %i.0.0 ; <int*>
>>> [#uses=2]
>>> br bool %tmp.4, label %then, label %else
>>>
>>> then: ; preds = %no_exit
>>> %tmp.9 = mul int %i.0.0, 40 ; <int> [#uses=1]
>>> store int %tmp.9, int* %tmp.7
>>> %inc9 = add int %i.0.0, 1 ; <int> [#uses=2]
>>> %tmp.112 = setlt int %inc9, 40 ; <bool> [#uses=1]
>>> br bool %tmp.112, label %no_exit, label %return
>>>
>>> else: ; preds = %no_exit
>>> %tmp.14 = mul int %i.0.0, %i.0.0 ; <int> [#uses=1]
>>> store int %tmp.14, int* %tmp.7
>>> %inc = add int %i.0.0, 1 ; <int> [#uses=2]
>>> %tmp.1 = setlt int %inc, 40 ; <bool> [#uses=1]
>>> br bool %tmp.1, label %no_exit, label %return
>>>
>>> return: ; preds = %else, %then
>>> ret void
>>> }
>>>
>>
>> -Chris
>>
>> --
>> http://nondot.org/sabre/
>> http://llvm.org/
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list