This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: another jump threading bug :(


On Wed, Jan 09, 2002 at 06:19:56PM +0100, Jan Hubicka wrote:
>   		{
> + 		  edge e;
> + 		  int prob;
>   		  if (n >= nthreaded_edges)
>   		    abort ();
>   		  t = threaded_edges [n++];
> + 		  if (t->src != first)
> + 		    abort ();
> + 		  if (first->frequency)
> + 		    prob = edge_frequency * REG_BR_PROB_BASE / first->frequency;
> + 		  else
> + 		    prob = 0;
> + 		  t->probability -= prob;
> + 		  prob = REG_BR_PROB_BASE - prob;
> + 		  if (prob == 0)
> + 		    first->succ->probability = REG_BR_PROB_BASE,
> + 		    first->succ->succ_next->probability = 0;
> + 		  for (e = first->succ; e; e = e->succ_next)
> + 		    e->probability = ((e->probability * REG_BR_PROB_BASE)
> + 				      / (double) (REG_BR_PROB_BASE - prob));

Still doesn't look right. You do REG_BR_PROB_BASE - prob there twice, which
is original prob in the end. End e.g. if first->frequency == 0 -> prob = 0
-> prob = 10000 -> / (10000 - 10000).
Even if you changed the code to / (double) prob, if (prob == 0) has no else,
so you'd divide by zero anyway.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]