Fix dumping of call cost in tail recursion optimization

When tail recursion optimization is detected (i.e. a jump to the
beginning of the function without creating a new stack frame),
Callgrind collects this as real call (ie. calculates inclusive
call costs), but forgot to dump the call information (the call
type is still left as a jump).
Fixed by also dump call information if inclusive cost is >0.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10780
This commit is contained in:
Josef Weidendorfer 2009-08-11 19:21:25 +00:00
parent 6a68dfd48d
commit 2cd5fcf5a7

View File

@ -832,7 +832,8 @@ static Bool fprint_bbcc(Int fd, BBCC* bbcc, AddrPos* last)
if (bb->jmp[jmp].instr == instr) {
jcc_count=0;
for(jcc=bbcc->jmp[jmp].jcc_list; jcc; jcc=jcc->next_from)
if ((jcc->jmpkind != Ijk_Call) && (jcc->call_counter >0))
if (((jcc->jmpkind != Ijk_Call) && (jcc->call_counter >0)) ||
(!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost )))
jcc_count++;
if (jcc_count>0) {
@ -845,7 +846,8 @@ static Bool fprint_bbcc(Int fd, BBCC* bbcc, AddrPos* last)
fprint_apos(fd, &(currCost->p), last, bbcc->cxt->fn[0]->file);
something_written = True;
for(jcc=bbcc->jmp[jmp].jcc_list; jcc; jcc=jcc->next_from) {
if ((jcc->jmpkind != Ijk_Call) && (jcc->call_counter >0))
if (((jcc->jmpkind != Ijk_Call) && (jcc->call_counter >0)) ||
(!CLG_(is_zero_cost)( CLG_(sets).full, jcc->cost )))
fprint_jcc(fd, jcc, &(currCost->p), last, ecounter);
}
}