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]

Re: New warning patch: Disabling gcse


> On Wed, Jul 26, 2000 at 10:40:55AM -0500, Brad Lucier wrote:
> > I don't understand what you mean by "proper".
> 
> Because now the compile will fail with -Werror.

OK, would you entertain this?  This way you have to ask for the
warning to get it, I believe.

	* toplev.c (warn_disabled_optimization): Declare new warning flag.
	* flags.h (warn_disabled_optimization): Add it here.
	* gcse.c (gcse_main): Add warning when disabled.
	* invoke.texi: Document -Wdisabled-optimization

Bootstrapped on alphaev6-unknown-linux-gnu with no regressions.

Brad

===================================================================
RCS file: RCS/flags.h,v
retrieving revision 1.1
diff -p -r1.1 flags.h
*** flags.h	2000/08/05 03:24:45	1.1
--- flags.h	2000/08/05 03:25:41
*************** extern int warn_packed;
*** 148,153 ****
--- 148,157 ----
  
  extern int warn_padded;
  
+ /* Warn when an optimization pass is disabled.  */
+ 
+ extern int warn_disabled_optimization;
+ 
  /* Nonzero if generating code to do profiling.  */
  
  extern int profile_flag;
===================================================================
RCS file: RCS/gcse.c,v
retrieving revision 1.1
diff -p -r1.1 gcse.c
*** gcse.c	2000/08/05 03:18:29	1.1
--- gcse.c	2000/08/05 05:36:53
*************** gcse_main (f, file)
*** 684,690 ****
       a couple switch statements.  So we require a relatively large number
       of basic blocks and the ratio of edges to blocks to be high.  */
    if (n_basic_blocks > 1000 && n_edges / n_basic_blocks >= 20)
!     return 0;
  
    /* See what modes support reg/reg copy operations.  */
    if (! can_copy_init_p)
--- 684,695 ----
       a couple switch statements.  So we require a relatively large number
       of basic blocks and the ratio of edges to blocks to be high.  */
    if (n_basic_blocks > 1000 && n_edges / n_basic_blocks >= 20)
!     {
!       if (warn_disabled_optimization)
! 	warning ("GCSE disabled: %d > 1000 basic blocks and %d >= 20 edges/basic block", 
! 		 n_basic_blocks, n_edges / n_basic_blocks);
!       return 0;
!     }
  
    /* See what modes support reg/reg copy operations.  */
    if (! can_copy_init_p)
===================================================================
RCS file: RCS/invoke.texi,v
retrieving revision 1.1
diff -p -r1.1 invoke.texi
*** invoke.texi	2000/08/05 14:32:59	1.1
--- invoke.texi	2000/08/05 14:34:49
*************** in the following sections.
*** 131,137 ****
  -fsyntax-only  -pedantic  -pedantic-errors
  -w  -W  -Wall  -Waggregate-return 
  -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment
! -Wconversion  -Werror  -Wformat
  -Wid-clash-@var{len}  -Wimplicit -Wimplicit-int 
  -Wimplicit-function-declaration  -Wimport
  -Werror-implicit-function-declaration  -Wfloat-equal -Winline
--- 131,137 ----
  -fsyntax-only  -pedantic  -pedantic-errors
  -w  -W  -Wall  -Waggregate-return 
  -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment
! -Wconversion  -Wdisabled-optimization -Werror  -Wformat
  -Wid-clash-@var{len}  -Wimplicit -Wimplicit-int 
  -Wimplicit-function-declaration  -Wimport
  -Werror-implicit-function-declaration  -Wfloat-equal -Winline
*************** Warn if @samp{long long} type is used.  
*** 1991,1996 ****
--- 1991,1999 ----
  the warning messages, use @samp{-Wno-long-long}.  Flags
  @samp{-Wlong-long} and @samp{-Wno-long-long} are taken into account
  only when @samp{-pedantic} flag is used.
+ 
+ @item -Wdisabled-optimization
+ Warn if a requested optimization pass is disabled.
  
  @item -Werror
  Make all warnings into errors.
===================================================================
RCS file: RCS/toplev.c,v
retrieving revision 1.1
diff -p -r1.1 toplev.c
*** toplev.c	2000/08/05 03:10:56	1.1
--- toplev.c	2000/08/05 03:28:05
*************** int warn_packed;
*** 1389,1394 ****
--- 1389,1398 ----
  
  int warn_padded;
  
+ /* Warn when an optimization pass is disabled.  */
+ 
+ int warn_disabled_optimization;
+ 
  /* Likewise for -W.  */
  
  lang_independent_options W_options[] =
*************** lang_independent_options W_options[] =
*** 1415,1421 ****
    {"packed", &warn_packed, 1,
     "Warn when the packed attribute has no effect on struct layout"},
    {"padded", &warn_padded, 1,
!    "Warn when padding is required to align struct members"}
  };
  
  /* Output files for assembler code (real compiler output)
--- 1419,1427 ----
    {"packed", &warn_packed, 1,
     "Warn when the packed attribute has no effect on struct layout"},
    {"padded", &warn_padded, 1,
!    "Warn when padding is required to align struct members"},
!   {"disabled-optimization", &warn_disabled_optimization, 1,
!    "Warn when an optimization pass is disabled"}
  };
  
  /* Output files for assembler code (real compiler output)

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