invoke.texi: Document -fdelete-null-pointer-checks
authorJeffrey A Law <law@cygnus.com>
Thu, 23 Sep 1999 19:57:50 +0000 (19:57 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 23 Sep 1999 19:57:50 +0000 (13:57 -0600)
        * invoke.texi: Document -fdelete-null-pointer-checks
        * toplev.c (flag_delete_null_pointer_checks): New.
        (f_options): Add entry for -fdelete-null-pointer-checks.
        (rest_of_compilation): Conditionalize null pointer check
        elimination on flag_delete_null_pointer_checks.
        (main): If -O2 or greater, enable -fdelete-null-pointer-checks

From-SVN: r29631

gcc/ChangeLog
gcc/invoke.texi
gcc/toplev.c

index 6b03ef3..febde95 100644 (file)
@@ -1,3 +1,12 @@
+Thu Sep 23 13:55:21 1999  Jeffrey A Law  (law@cygnus.com)
+
+       * invoke.texi: Document -fdelete-null-pointer-checks
+       * toplev.c (flag_delete_null_pointer_checks): New.
+       (f_options): Add entry for -fdelete-null-pointer-checks.
+       (rest_of_compilation): Conditionalize null pointer check
+       elimination on flag_delete_null_pointer_checks.
+       (main): If -O2 or greater, enable -fdelete-null-pointer-checks
+
 1999-09-23 10:56 -0700  Zack Weinberg  <zack@bitmover.com>
 
        * iso646.h, stdarg.h, stdbool.h, stddef.h, varargs.h: Add
index a8190d9..43339b8 100644 (file)
@@ -153,7 +153,7 @@ in the following sections.
 -falign-functions=@var{n}  -falign-labels=@var{n}  -falign-loops=@var{n} 
 -falign-jumps=@var{n}  -fbranch-probabilities  
 -fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
--fdelayed-branch   -fexpensive-optimizations
+-fdelayed-branch  -fdelete-null-pointer-checks -fexpensive-optimizations
 -ffast-math  -ffloat-store  -fforce-addr  -fforce-mem -fno-math-errno
 -fdata-sections  -ffunction-sections  -fgcse 
 -finline-functions  -finline-limit=@var{n}  -fkeep-inline-functions
@@ -2459,6 +2459,14 @@ Run the loop optimizer twice.
 Perform a global common subexpression elimination pass.
 This pass also performs global constant and copy propagation.
 
+@item -fdelete-null-pointer-checks
+Use global dataflow analysis to identify and eliminate useless null
+pointer checks.  Programs which rely on NULL pointer dereferences @emph{not}
+halting the program may not work properly with this option.  Use
+-fno-delete-null-pointer-checks to disable this optimizing for programs
+which depend on that behavior.
+
+
 @item -fexpensive-optimizations
 Perform a number of minor optimizations that are relatively expensive.
 
index 6cbbaf4..9f08f7d 100644 (file)
@@ -568,6 +568,11 @@ int flag_syntax_only = 0;
 
 static int flag_gcse;
 
+/* Nonzero means to use global dataflow analysis to eliminate
+   useless null pointer tests.  */
+
+static int flag_delete_null_pointer_checks;
+
 /* Nonzero means to rerun cse after loop optimization.  This increases
    compilation time about 20% and picks up a few more common expressions.  */
 
@@ -894,6 +899,8 @@ lang_independent_options f_options[] =
    "Run CSE pass after loop optimisations"},
   {"rerun-loop-opt", &flag_rerun_loop_opt, 1,
    "Run the loop optimiser twice"},
+  {"delete-null-pointer-checks", &flag_delete_null_pointer_checks, 1,
+   "Delete useless null pointer checks" },
   {"pretend-float", &flag_pretend_float, 1,
    "Pretend that host and target use the same FP format"},
   {"schedule-insns", &flag_schedule_insns, 1,
@@ -3707,7 +3714,7 @@ rest_of_compilation (decl)
     goto exit_rest_of_compilation;
 
   /* Try to identify useless null pointer tests and delete them.  */
-  if (optimize > 1)
+  if (flag_delete_null_pointer_checks)
     TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
 
   /* Dump rtl code after jump, if we are doing that.  */
@@ -3746,7 +3753,7 @@ rest_of_compilation (decl)
                                           !JUMP_AFTER_REGSCAN));
  
       /* Try to identify useless null pointer tests and delete them.  */
-      if (optimize > 1)
+      if (flag_delete_null_pointer_checks)
        TIMEVAR (jump_time, delete_null_pointer_checks (get_insns ()));
 
       /* Dump rtl code after cse, if we are doing that.  */
@@ -5322,6 +5329,7 @@ main (argc, argv)
 #endif
       flag_regmove = 1;
       flag_strict_aliasing = 1;
+      flag_delete_null_pointer_checks = 1;
     }
 
   if (optimize >= 3)