<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>hi, </FONT></DIV>
<DIV><FONT face=Arial size=2> 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. </FONT></DIV>
<DIV><FONT face=Arial size=2> 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. </FONT></DIV>
<DIV><FONT face=Arial size=2>-Wei</FONT></DIV><FONT face=Arial size=2>
<DIV> </DIV>
<DIV>Test.c: <BR>#include "stdio.h"</DIV>
<DIV>#define N 40<BR>void func1() {<BR> int a[N];<BR> int
i,j;<BR> for (i=0; i<N; i++) {<BR> if
(i==0)<BR> a[i] =
i*N;<BR>
else<BR> a[i] = i*i;<BR>
}<BR>}<BR></DIV>
<DIV>Test.ll:</DIV>
<DIV>void %func1() {<BR>entry:<BR> %a
= alloca [40 x int] ;
<[40 x int]*> [#uses=1]<BR> br
label %no_exit</DIV>
<DIV> </DIV>
<DIV>no_exit:
; preds = %else, %then, %entry<BR>
%i.0.0 = phi int [ 0, %entry ], [ %inc9, %then ], [ %inc, %else
] ; <int>
[#uses=7]<BR> %tmp.4 = seteq int
%i.0.0, 0 ;
<bool> [#uses=1]<BR> %tmp.7 =
getelementptr [40 x int]* %a, int 0, int
%i.0.0
; <int*> [#uses=2]<BR> br bool
%tmp.4, label %then, label %else</DIV>
<DIV> </DIV>
<DIV>then: ; preds =
%no_exit<BR> %tmp.9 = mul int %i.0.0,
40 ;
<int> [#uses=1]<BR> store int
%tmp.9, int* %tmp.7<BR> %inc9 = add
int %i.0.0,
1
; <int> [#uses=2]<BR> %tmp.112 =
setlt int %inc9, 40 ;
<bool> [#uses=1]<BR> br bool
%tmp.112, label %no_exit, label %return</DIV>
<DIV> </DIV>
<DIV>else: ; preds =
%no_exit<BR> %tmp.14 = mul int %i.0.0,
%i.0.0
; <int> [#uses=1]<BR> store int
%tmp.14, int* %tmp.7<BR> %inc = add
int %i.0.0,
1
; <int> [#uses=2]<BR> %tmp.1 =
setlt int %inc,
40 ;
<bool> [#uses=1]<BR> br bool
%tmp.1, label %no_exit, label %return</DIV>
<DIV> </DIV>
<DIV>return: ; preds = %else,
%then<BR> ret
void<BR>}<BR></DIV></FONT></BODY></HTML>