From b6d24183dfb4a8194e3b0357ce44723735ad0da1 Mon Sep 17 00:00:00 2001 From: Jeffrey A Law Date: Thu, 23 Sep 1999 19:57:50 +0000 Subject: [PATCH] invoke.texi: Document -fdelete-null-pointer-checks * 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 | 9 +++++++++ gcc/invoke.texi | 10 +++++++++- gcc/toplev.c | 12 ++++++++++-- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6b03ef324f7..febde95d3dc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 * iso646.h, stdarg.h, stdbool.h, stddef.h, varargs.h: Add diff --git a/gcc/invoke.texi b/gcc/invoke.texi index a8190d9cdad..43339b80769 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -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. diff --git a/gcc/toplev.c b/gcc/toplev.c index 6cbbaf45a46..9f08f7d5aab 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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) -- 2.30.2