]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
predict.c (estimate_bb_frequencies): Do frequency calculation with a volatile temporary.
authorRichard Henderson <rth@redhat.com>
Thu, 4 Apr 2002 21:38:40 +0000 (13:38 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 4 Apr 2002 21:38:40 +0000 (13:38 -0800)
        * predict.c (estimate_bb_frequencies): Do frequency calculation
        with a volatile temporary.

From-SVN: r51879

gcc/ChangeLog
gcc/predict.c

index 7c9f421303a828a7563d314749df3fc6244be2be..23e407a49dece026697c647765d4c936b3950f60 100644 (file)
@@ -1,3 +1,8 @@
+2002-04-04  Richard Henderson  <rth@redhat.com>
+
+       * predict.c (estimate_bb_frequencies): Do frequency calculation
+       with a volatile temporary.
+
 2002-04-04  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * config/s390/linux.h (LOCAL_LABEL_PREFIX): Define.
index 56b04365b3f7dbe1aeaf3ed5383b0a75260ae215..1d8691c9d2222862a9aa1e0344e7025726c68d7f 100644 (file)
@@ -942,6 +942,7 @@ estimate_bb_frequencies (loops)
   for (i = -2; i < n_basic_blocks; i++)
     {
       basic_block bb;
+      volatile double tmp;
 
       if (i == -2)
        bb = ENTRY_BLOCK_PTR;
@@ -949,8 +950,12 @@ estimate_bb_frequencies (loops)
        bb = EXIT_BLOCK_PTR;
       else
        bb = BASIC_BLOCK (i);
-      bb->frequency
-       = BLOCK_INFO (bb)->frequency * BB_FREQ_MAX / freq_max + 0.5;
+
+      /* ??? Prevent rounding differences due to optimization on x86.  */
+      tmp = BLOCK_INFO (bb)->frequency * BB_FREQ_MAX;
+      tmp /= freq_max;
+      tmp += 0.5;
+      bb->frequency = tmp;
     }
 
   free_aux_for_blocks ();