toplev.c (warn_disabled_optimization): Declare new warning flag.
authorBrad Lucier <lucier@math.purdue.edu>
Fri, 22 Sep 2000 07:22:07 +0000 (07:22 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 22 Sep 2000 07:22:07 +0000 (07:22 +0000)
        * 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

Co-Authored-By: Mark Mitchell <mark@codesourcery.com>
From-SVN: r36568

gcc/ChangeLog
gcc/flags.h
gcc/gcse.c
gcc/invoke.texi
gcc/toplev.c

index 49524b493533c47ead16ea77e1d6782c91531b02..c44d716ebda247101b0f779164cb1820db452bf7 100644 (file)
@@ -1,3 +1,11 @@
+2000-09-22  Brad Lucier <lucier@math.purdue.edu>
+           Mark Mitchell  <mark@codesourcery.com>
+
+        * 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
+
 2000-09-21  Jason Merrill  <jason@redhat.com>
 
        * dwarf2out.c (add_const_value_attribute): Multiply by length, not 4.
index 8fa2e87d00cb8809f4b0357f68b2ae457df8cd1f..6a87edb8e63b8cd61ba57822a8fc17190acf31ff 100644 (file)
@@ -160,6 +160,10 @@ extern int warn_packed;
 
 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;
index d32ddeb063d86825f2e740b350c05b606b21d9d7..ba07aa75444389ef59df3fe60ec45546cc754a8e 100644 (file)
@@ -685,7 +685,12 @@ gcse_main (f, file)
      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;
+    {
+      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)
index cea95c4e2671c1e69e6f0e8806dee1ba126fb8f8..43aafbade452247d69437c691b27352d3b759e75 100644 (file)
@@ -131,7 +131,7 @@ in the following sections.
 -fsyntax-only  -pedantic  -pedantic-errors
 -w  -W  -Wall  -Waggregate-return 
 -Wcast-align  -Wcast-qual  -Wchar-subscripts  -Wcomment
--Wconversion  -Werror  -Wformat
+-Wconversion  -Wdisabled-optimization -Werror  -Wformat
 -Wid-clash-@var{len}  -Wimplicit -Wimplicit-int 
 -Wimplicit-function-declaration  -Wimport
 -Werror-implicit-function-declaration  -Wfloat-equal -Winline
@@ -2018,6 +2018,14 @@ 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.  This warning does
+not generally indicate that there is anything wrong with your code; it
+merely indicates that GCC's optimizers were unable to handle the code
+effectively.  Often, the problem is that your code is too big or too
+complex; GCC will refuse to optimize programs when the optimization
+itself is likely to take inordinate amounts of time.
+
 @item -Werror
 Make all warnings into errors.
 @end table
index 74e0e3ebcaebb1b206c5e7e264369a35b3d99e5f..76ff873f13ad0a057a78c8fb3a3dc22564b7b602 100644 (file)
@@ -1397,6 +1397,10 @@ int warn_packed;
 
 int warn_padded;
 
+/* Warn when an optimization pass is disabled.  */
+
+int warn_disabled_optimization;
+
 /* Likewise for -W.  */
 
 lang_independent_options W_options[] =
@@ -1423,7 +1427,9 @@ lang_independent_options W_options[] =
   {"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"}
+   "Warn when padding is required to align struct members"},
+  {"disabled-optimization", &warn_disabled_optimization, 1,
+   "Warn when an optimization pass is disabled"}
 };
 \f
 /* Output files for assembler code (real compiler output)