Hello gssict, I've met just the same problem you met 2 years ago. The only
difference is that I'm new to LLVM while you were familiar with it and shall
be an expert at
it now. Since there is no answer to this question and series of questions
about path profiling, I have to solve it by myself.
I think the result you get is meaningful, though it needs further
regeneration to get the corresponding paths. I just read the paper96 by B&L,
and view the tech-
report2010 by Adam(seems that he implements the pp) I find:
1.The algorithm just focuses on intraprocedural, so each function has its
own path count(supported by the result);
2.Despite self loops, every backedge(at the end of while, for ...) leads to
an increment=1 of path count;
3.For self loops(there is one in the
common_fft,"for(stage=1;&&(j=j/2)!=1;stage++) ;"),increment
should be made
inside basic block;
4.Combining 2 and 3, I manually instrument common_fft:
#--------------------------------------------------------------------------------------------------#
for(i=0;i<nfft-1;i++)
{ ++blcount;
if(i<j)
{
t=x[j];
x[j]=x[i];
x[i]=t;
}
k=nfft/2;
while(k<=j)
{ ++blcount;
j-=k;
k/=2;
}
j+=k;
}
int stage,le,lei,ip;
COMPLEX u,w;
j= nfft;
for(stage=1;(++blcount)&&(j=j/2)!=1;stage++) ; //caculate
stage,which
represents butterfly stages
for(k=1;k<=stage;k++)
{ ++blcount;
le=2<<(k-1);
lei=le/2;
u.real=1.0;// u,butterfly factor initial value
u.img=0.0;
w.real=cos(PI/lei*isign);
w.img=sin(PI/lei*isign);
for(j=0;j<=lei-1;j++)
{ ++blcount;
for(i=j;i<=nfft-1;i+=le)
{ ++blcount;
ip=i+lei;
t=EE(x[ip],u);
x[ip].real=x[i].real-t.real;
x[ip].img=x[i].img-t.img;
x[i].real=x[i].real+t.real;
x[i].img=x[i].img+t.img;
}
u=EE(u,w);
}
}
#--------------------------------------------------------------------------------------------------#
Initially, blcount=0. And at the end of main, I print it out and get 162,
which equals to the sum of path counts of common_fft in your result.
5.What's more, combining 2, 3 and the rule of increment at the EXIT, we can
infer that during every execution of common_fft, every 1st backedge/selfloop
should be
recorded and it is different from other backedge/selfloop. Since there are 6
such backedge/selfloop, and common_fft executed 2 times, under the condition
that every
backedge/selfloop is executed, there should be exactly 6 counts of 2, which
is supported by your result!
Now at the end of my answer, I think the remaining question is how to
regenerate the paths.
I am new to LLVM, so I hope you can help me with how to output path
profiling result.
Desire for your help!!
Raymond Chen.
--
View this message in context:
http://llvm.1065342.n5.nabble.com/path-profile-result-with-LLVM-tp56354p83568.html
Sent from the LLVM - Dev mailing list archive at Nabble.com.