From 2cd5fcf5a74ea75164a377c38aae1cb19d16a42c Mon Sep 17 00:00:00 2001 From: Josef Weidendorfer Date: Tue, 11 Aug 2009 19:21:25 +0000 Subject: [PATCH] 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 --- callgrind/dump.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/callgrind/dump.c b/callgrind/dump.c index 488775afd4..58b3953b1e 100644 --- a/callgrind/dump.c +++ b/callgrind/dump.c @@ -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); } } -- 2.47.3