Fix bugs catched by BEAM

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11742 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/callgrind/sim.c b/callgrind/sim.c
index 2b8cbe4..60b2987 100644
--- a/callgrind/sim.c
+++ b/callgrind/sim.c
@@ -977,7 +977,7 @@
   if (!CLG_(current_state).collect) return;
 
   CLG_(bb_base) = 0;
-  current_ii = ⅈ
+  current_ii = ⅈ /* needs to be set for update_XX_use */
   CLG_(cost_base) = 0;
 
   /* update usage counters */
@@ -995,6 +995,8 @@
     for (i = 0; i < LL.sets * LL.assoc; i++)
       if (LL.loaded[i].use_base)
 	update_LL_use(i, 0);
+
+  current_ii = 0;
 }