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: Minor cleanups in predict.c


>     I would preffer the casts to keep. The assumption that gcov_type ==
>     HOST_WIDEST_INT is bit fragile.
> 
> There's a typedef in basic-block.h that makes the two the same.  There really

Yes, but the plan has been to make it easy to change in future - thats the purpose
of gcov_type after all.

> shouldn't be a cast at all: the printf should have the right type.  If this
> changes, we shoudl change the printf.
> 
>     The volatile here is mandatory, as discussed in earlier comment
>     (perhaps it should be compiled here too), to avoid bootstrap
>     misscomparisons on i386.  
> 
> Yes, there should most *definitely* be a comment there!
Agreed.
> 
>     When volatile is not present, the cyclic_probablility is computed in
>     80bit frequency in the optimizer compiler making results slightly
>     different that shows off with tracer present on the cfg branch.
> 
> This suggests that perhaps FP isn't appropriate here.  I really don't

Yes, this has been discussed earlier too. Sadly to replace it we need major
features of fp arithmetics - addition and multiplication and it is not enought
to use logarithms (the purpose of FP is to allow frequencies to be relativly
large - as happends in the large amount of nested loops and low - as happends
in deep decision trees), as they are not exact enought.

> think we want to have to get into such things within GCC.  Numerical
> error shouldn't affect things this much.
OK?

Sun Dec 23 00:40:10 CET 2001  Jan Hubicka  <jh@suse.cz>
	* predict.c (block_info_def): Document volatile.
	(propagate_freq): Add volatile for cyclic_probability;
	add comment.

Index: predict.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/predict.c,v
retrieving revision 1.51
diff -c -3 -p -r1.51 predict.c
*** predict.c	2001/12/22 15:37:09	1.51
--- predict.c	2001/12/22 23:39:19
*************** expected_value_to_br_prob ()
*** 612,618 ****
  
  typedef struct block_info_def
  {
!   /* Estimated frequency of execution of basic_block.  */
    volatile double frequency;
  
    /* To keep queue of basic blocks to process.  */
--- 612,621 ----
  
  typedef struct block_info_def
  {
!   /* Estimated frequency of execution of basic_block.
! 
!      Volatile is needed to avoid differences in the optimized and unoptimized
!      builds on machines where FP registers are wider than double.  */
    volatile double frequency;
  
    /* To keep queue of basic blocks to process.  */
*************** propagate_freq (head)
*** 679,685 ****
    BLOCK_INFO (head)->frequency = 1;
    for (; bb; bb = nextbb)
      {
!       double cyclic_probability = 0, frequency = 0;
  
        nextbb = BLOCK_INFO (bb)->next;
        BLOCK_INFO (bb)->next = NULL;
--- 682,691 ----
    BLOCK_INFO (head)->frequency = 1;
    for (; bb; bb = nextbb)
      {
!       /* Volatile is needed to avoid differences in the optimized and
!          unoptimized builds on machines where FP registers are wider than
! 	 double.  */
!       volatile double cyclic_probability = 0, frequency = 0;
  
        nextbb = BLOCK_INFO (bb)->next;
        BLOCK_INFO (bb)->next = NULL;


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