> Hi, > > Thanks a lot. Basically, I want to obtain dynamic basic block frequency at > RTL > level just before register allocation. Look at the following piece of > code(a.c): > > void foo(int i, int *a, int *p) { > int x1,j; > for(j=0;j<200;j++) { > x1=a[i]+j; > *p=99; > a[i]=x1; > } > } > > main() { > int *a,*p,i=0; > int x1,x2,x3,x4; > a=malloc(sizeof(int)); > p=malloc(sizeof(int)); > a[0]=0; > foo(0,a,p); > printf("\n%d ",*p); > for(i=0;i<1;i++) { > printf(" %d ",a[i]); > } > } > > This code was executed using "gcc -O3 -fprofile-arcs --param > max-unroll-times=0 a.c". > "a.out" was then executed (for profiling). > Now I compile using "gcc -O3 -fbranch-probabilities --param > max-unroll-times=0 a.c". > During this phase, I try to obtain dynamic frequencies of the statements > within the "for" > loop in "foo" method at RTL level. The frequencies return "0" using > "bb->count". I > would like this to reflect "200". How to obtain this information?
I think the problem is that foo gets inlined into main, so the offline copy of foo is really never executed. Honza > > regards, > Raj > > > > > > > > Jan Hubicka <[EMAIL PROTECTED]> > 07/18/2005 10:29 AM > > To > Rajkishore Barik/India/[EMAIL PROTECTED] > cc > gcc@gcc.gnu.org > Subject > Re: -fprofile-arcs > > > > > > > > Hi, > > > > I am trying to profile the frequency of each basic block of > > SPEC 2000 benchmarks by compiling them using -fprofile-arcs and opt -O3. > > After running the benchmark, when I try to read "bb->count" while > > compiling > > using "-fbranch-probabilities and -O3", I get "0" values for basic > blocks > > which were known to execute for sure. Any clue as to where I am missing? > > Is "bb->count" is the right way to get the dynamic frequency in the > second > > pass? > > It is. You would need to provide more information for me to figure out > what is going wrong. Of course the bb->count is initialized only after > profile is read in that at current mainline is pretty late in > compilation queue (after bp RTL pass), but this is going to change > hopefully at monday. > > Honza > > > > regards, > > Raj >