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]

Enable loop optimization only if optimize > 0 too


Hi,

with checking enabled and "-O0 -funroll-loops"
compilation of following testcase ICEs in verify_flow_info
because of negative frequencies of basic blocks.
This is because we do not run branch prediction on -O0
and thus the probabilities of edges are 0.
estimate_frequencies then makes the frequencies ob blocks to be -1.

This patch fixes it by enabling loop optimization only if
optimize > 0 too.

OK for mainline?

Josef

2003-09-02  Josef Zlomek  <zlomekj@suse.cz>

	* toplev.c (rest_of_compilation): Run loop optimizations only
	if optimize > 0.

Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.688.2.29
diff -c -3 -p -r1.688.2.29 toplev.c
*** toplev.c	14 Aug 2003 13:20:15 -0000	1.688.2.29
--- toplev.c	2 Sep 2003 12:15:55 -0000
*************** rest_of_compilation (decl)
*** 3138,3144 ****
      }
  
    /* Perform loop optimalizations.  */
!   if (flag_unswitch_loops)
      {
        struct loops *loops;
        timevar_push (TV_LOOP);
--- 3138,3144 ----
      }
  
    /* Perform loop optimalizations.  */
!   if (optimize > 0 && flag_unswitch_loops)
      {
        struct loops *loops;
        timevar_push (TV_LOOP);
*************** rest_of_compilation (decl)
*** 3199,3205 ****
      }
  
    /* Perform loop optimalizations.  */
!   if (flag_peel_loops || flag_unroll_loops)
      {
        struct loops *loops;
        timevar_push (TV_LOOP);
--- 3199,3206 ----
      }
  
    /* Perform loop optimalizations.  */
!   if (optimize > 0
!       && (flag_peel_loops || flag_unroll_loops))
      {
        struct loops *loops;
        timevar_push (TV_LOOP);


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