common.opt (fdelete-null-pointer-checks): Init to -1.
authorSandra Loosemore <sandra@codesourcery.com>
Mon, 4 May 2015 19:55:06 +0000 (15:55 -0400)
committerSandra Loosemore <sandra@gcc.gnu.org>
Mon, 4 May 2015 19:55:06 +0000 (15:55 -0400)
2015-05-04  Sandra Loosemore  <sandra@codesourcery.com>

gcc/
* common.opt (fdelete-null-pointer-checks): Init to -1.
* config/nios2/elf.h (SUBTARGET_OVERRIDE_OPTIONS): Define to
override flag_delete_null_pointer_checks default.
* doc/invoke.texi (-fdelete-null-pointer-checks): Clarify
behavior re address zero.  Better document target-specific behavior.
(-fisolate-errneous-paths-dereference): Mention relationship to
-fdelete-null-pointer-checks.

gcc/testsuite/
* lib/target-supports.exp
(check_effective_target_keeps_null_pointer_checks): Clarify that
this is for targets that disable -fdelete-null-pointer-checks,
not default it to off.
* gcc.dg/ipa/ipa-pta-14.c: Make dependence on
-fdelete-null-pointer-checks explicit.
* gcc.dg/tree-ssa/20030730-1.c: Likewise.
* gcc.dg/tree-ssa/20030730-2.c: Likewise.
* gcc.dg/tree-ssa/isolate-1.c: Likewise.
* gcc.dg/tree-ssa/isolate-2.c: Likewise.
* gcc.dg/tree-ssa/isolate-3.c: Likewise.
* gcc.dg/tree-ssa/isolate-4.c: Likewise.
* gcc.dg/tree-ssa/isolate-5.c: Likewise.
* gcc.dg/tree-ssa/nonzero-1.c: Likewise.
* gcc.dg/tree-ssa/pr20318.c: Likewise.
* gcc.dg/tree-ssa/pr20701.c: Likewise.
* gcc.dg/tree-ssa/pr20702.c: Likewise.
* gcc.dg/tree-ssa/pr21086.c: Likewise.
* gcc.dg/tree-ssa/pr21090.c: Likewise.
* gcc.dg/tree-ssa/pr58480.c: Likewise.
* gcc.dg/tree-ssa/pta-escape-1.c: Likewise.
* gcc.dg/tree-ssa/pta-escape-2.c: Likewise.
* gcc.dg/tree-ssa/pta-escape-3.c: Likewise.
* gcc.dg/tree-ssa/ssa-vrp-thread-1.c: Likewise.
* gcc.dg/tree-ssa/unreachable.c: Likewise.
* gcc.dg/tree-ssa/vrp02.c: Likewise.
* gcc.dg/tree-ssa/vrp07.c: Likewise.
* gcc.dg/tree-ssa/vrp08.c: Likewise.
* gcc.dg/tree-ssa/vrp55.c: Likewise.
* g++.dg/cpp0x/static_assert9.C: Likewise.
* g++.dg/tree-ssa/nonzero-1.C: Likewise.
* g++.dg/tree-ssa/pr19476-1.C: Likewise.
* g++.dg/tree-ssa/pr19476-2.C: Likewise.
* g++.dg/tree-ssa/pr19476-5.C: Likewise.
* g++.dg/tree-ssa/pr26406.C: Likewise.

From-SVN: r222777

36 files changed:
gcc/ChangeLog
gcc/common.opt
gcc/config/nios2/elf.h
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/static_assert9.C
gcc/testsuite/g++.dg/tree-ssa/nonzero-1.C
gcc/testsuite/g++.dg/tree-ssa/pr19476-1.C
gcc/testsuite/g++.dg/tree-ssa/pr19476-2.C
gcc/testsuite/g++.dg/tree-ssa/pr19476-5.C
gcc/testsuite/g++.dg/tree-ssa/pr26406.C
gcc/testsuite/gcc.dg/ipa/ipa-pta-14.c
gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c
gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-1.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-2.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-3.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-4.c
gcc/testsuite/gcc.dg/tree-ssa/isolate-5.c
gcc/testsuite/gcc.dg/tree-ssa/nonzero-1.c
gcc/testsuite/gcc.dg/tree-ssa/pr20318.c
gcc/testsuite/gcc.dg/tree-ssa/pr20701.c
gcc/testsuite/gcc.dg/tree-ssa/pr20702.c
gcc/testsuite/gcc.dg/tree-ssa/pr21086.c
gcc/testsuite/gcc.dg/tree-ssa/pr21090.c
gcc/testsuite/gcc.dg/tree-ssa/pr58480.c
gcc/testsuite/gcc.dg/tree-ssa/pta-escape-1.c
gcc/testsuite/gcc.dg/tree-ssa/pta-escape-2.c
gcc/testsuite/gcc.dg/tree-ssa/pta-escape-3.c
gcc/testsuite/gcc.dg/tree-ssa/ssa-vrp-thread-1.c
gcc/testsuite/gcc.dg/tree-ssa/unreachable.c
gcc/testsuite/gcc.dg/tree-ssa/vrp02.c
gcc/testsuite/gcc.dg/tree-ssa/vrp07.c
gcc/testsuite/gcc.dg/tree-ssa/vrp08.c
gcc/testsuite/gcc.dg/tree-ssa/vrp55.c
gcc/testsuite/lib/target-supports.exp

index 4837a9178af348191cd1c5799ac3fcaf5328aa49..116a6d6435952dc00a5ada859a0e4a52d7492b34 100644 (file)
@@ -1,3 +1,13 @@
+2015-05-04  Sandra Loosemore  <sandra@codesourcery.com>
+
+       * common.opt (fdelete-null-pointer-checks): Init to -1.
+       * config/nios2/elf.h (SUBTARGET_OVERRIDE_OPTIONS): Define to
+       override flag_delete_null_pointer_checks default.
+       * doc/invoke.texi (-fdelete-null-pointer-checks): Clarify
+       behavior re address zero.  Better document target-specific behavior.
+       (-fisolate-errneous-paths-dereference): Mention relationship to
+       -fdelete-null-pointer-checks.
+
 2015-05-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/65984
index 380848c7087d406bd3764fceb410f4964169f335..51833c17e49cd1378bae1759c877b7ca69edd451 100644 (file)
@@ -1070,7 +1070,7 @@ Common Report Var(flag_delete_dead_exceptions) Init(0) Optimization
 Delete dead instructions that may throw exceptions
 
 fdelete-null-pointer-checks
-Common Report Var(flag_delete_null_pointer_checks) Init(1) Optimization
+Common Report Var(flag_delete_null_pointer_checks) Init(-1) Optimization
 Delete useless null pointer checks
 
 fdevirtualize-at-ltrans
index 243596a0281c2f44eb3741bd7b6795d1cea347fd..84b44d42258cc596fecd2c1f766be250db454c6e 100644 (file)
 /* The ELF target doesn't support the Nios II Linux ABI.  */
 #define TARGET_LINUX_ABI 0
 
+/* Default -fdelete-null-pointer-checks to off, to prevent the compiler
+   from treating accesses to address zero as traps.  On bare-metal Nios II
+   targets address zero may legitimately be mapped to memory (e.g., the
+   hardware description may specify this as the address of the interrupt
+   vector).  Users can override this on the command line to get the
+   additional optimizations it enables.  */
+#define SUBTARGET_OVERRIDE_OPTIONS             \
+  if (flag_delete_null_pointer_checks < 0)     \
+    flag_delete_null_pointer_checks = 0
index 7d2f6e58a41e004a28ac410d80736246794c2b22..972d3550ca306605d33d36b6d253681b2c4a63a5 100644 (file)
@@ -8014,10 +8014,12 @@ Enabled by @option{-Os}.
 @item -fdelete-null-pointer-checks
 @opindex fdelete-null-pointer-checks
 Assume that programs cannot safely dereference null pointers, and that
-no code or data element resides there.  This enables simple constant
+no code or data element resides at address zero.
+This option enables simple constant
 folding optimizations at all optimization levels.  In addition, other
 optimization passes in GCC use this flag to control global dataflow
 analyses that eliminate useless checks for null pointers; these assume
+that a memory access to address zero always results in a trap, so
 that if a pointer is checked after it has already been dereferenced,
 it cannot be null.
 
@@ -8025,9 +8027,10 @@ Note however that in some environments this assumption is not true.
 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
 for programs that depend on that behavior.
 
-Some targets, especially embedded ones, disable this option at all levels.
-Otherwise it is enabled at all levels: @option{-O0}, @option{-O1},
-@option{-O2}, @option{-O3}, @option{-Os}.  Passes that use the information
+This option is enabled by default on most targets.  On Nios II ELF, it
+defaults to off.  On AVR and CR16, this option is completely disabled.  
+
+Passes that use the dataflow information
 are enabled independently at different optimization levels.
 
 @item -fdevirtualize
@@ -8510,7 +8513,8 @@ This flag is enabled by default at @option{-O2} and @option{-Os}.
 Detect paths that trigger erroneous or undefined behavior due to
 dereferencing a null pointer.  Isolate those paths from the main control
 flow and turn the statement with erroneous or undefined behavior into a trap.
-This flag is enabled by default at @option{-O2} and higher.
+This flag is enabled by default at @option{-O2} and higher and depends on
+@option{-fdelete-null-pointer-checks} also being enabled.
 
 @item -fisolate-erroneous-paths-attribute
 @opindex fisolate-erroneous-paths-attribute
index 9525115e9d86f9a3cd2c82afaecee8c001a5c701..3673938aab0858af01fe1ca70ce1ce791a5272c2 100644 (file)
@@ -1,3 +1,41 @@
+2015-05-04  Sandra Loosemore  <sandra@codesourcery.com>
+
+       * lib/target-supports.exp
+       (check_effective_target_keeps_null_pointer_checks): Clarify that
+       this is for targets that disable -fdelete-null-pointer-checks,
+       not default it to off.
+       * gcc.dg/ipa/ipa-pta-14.c: Make dependence on
+       -fdelete-null-pointer-checks explicit.
+       * gcc.dg/tree-ssa/20030730-1.c: Likewise.
+       * gcc.dg/tree-ssa/20030730-2.c: Likewise.
+       * gcc.dg/tree-ssa/isolate-1.c: Likewise.
+       * gcc.dg/tree-ssa/isolate-2.c: Likewise.
+       * gcc.dg/tree-ssa/isolate-3.c: Likewise.
+       * gcc.dg/tree-ssa/isolate-4.c: Likewise.
+       * gcc.dg/tree-ssa/isolate-5.c: Likewise.
+       * gcc.dg/tree-ssa/nonzero-1.c: Likewise.
+       * gcc.dg/tree-ssa/pr20318.c: Likewise.
+       * gcc.dg/tree-ssa/pr20701.c: Likewise.
+       * gcc.dg/tree-ssa/pr20702.c: Likewise.
+       * gcc.dg/tree-ssa/pr21086.c: Likewise.
+       * gcc.dg/tree-ssa/pr21090.c: Likewise.
+       * gcc.dg/tree-ssa/pr58480.c: Likewise.
+       * gcc.dg/tree-ssa/pta-escape-1.c: Likewise.
+       * gcc.dg/tree-ssa/pta-escape-2.c: Likewise.
+       * gcc.dg/tree-ssa/pta-escape-3.c: Likewise.
+       * gcc.dg/tree-ssa/ssa-vrp-thread-1.c: Likewise.
+       * gcc.dg/tree-ssa/unreachable.c: Likewise.
+       * gcc.dg/tree-ssa/vrp02.c: Likewise.
+       * gcc.dg/tree-ssa/vrp07.c: Likewise.
+       * gcc.dg/tree-ssa/vrp08.c: Likewise.
+       * gcc.dg/tree-ssa/vrp55.c: Likewise.
+       * g++.dg/cpp0x/static_assert9.C: Likewise.
+       * g++.dg/tree-ssa/nonzero-1.C: Likewise.
+       * g++.dg/tree-ssa/pr19476-1.C: Likewise.
+       * g++.dg/tree-ssa/pr19476-2.C: Likewise.
+       * g++.dg/tree-ssa/pr19476-5.C: Likewise.
+       * g++.dg/tree-ssa/pr26406.C: Likewise.
+
 2015-05-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/65984
index fccaa449c170afc22b1547f6c210b0538f4e5d7c..46d7f25231a15a49083963777b9ac00c63d83b34 100644 (file)
@@ -1,5 +1,7 @@
 // PR c++/58837
 // { dg-require-effective-target c++11 }
+// { dg-skip-if "" keeps_null_pointer_checks }
+// { dg-options "-fdelete-null-pointer-checks" }
 
 void f();
 static_assert(f, "");
index 60da49dca3737ea35888a92dfa4eb9b0550d2393..7b422db702b62a2200f25af7b664d7ccd9b6abd5 100644 (file)
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-ccp1" } */
+/* { dg-options "-O2 -fdump-tree-ccp1 -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */
+
 inline void t()
 {
 }
index cbdad90d16b4e6d577ffddc37ade9439ee4d96c4..837975155f71455ad46650e49ad7df0ecf52f783 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-ccp1" } */
+/* { dg-options "-O -fdump-tree-ccp1 -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */
 
 // See pr19476-5.C for a version without including <new>.
 #include <new>
index 70002dbb5ea2edb54c6fd1323dad3210f95e31a6..e72a8fbfb5a2a44723d5f84b406c4a79ef528afe 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */
 
 #include <new>
 
index bec0bb58b6c4c2e34c3a42457836a43df433b423..921d7302fd84f136aa5ec6365e72fc3d7e926843 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-options "-O -fdump-tree-ccp1" } */
+/* { dg-options "-O -fdump-tree-ccp1 -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */
 
 // See pr19476-1.C for a version that includes <new>.
 
index c2d160508a67441d07b1e0c94ca176a5d026f0a4..d70e8049f847e3b9e33dbb69f42b61aea2020b3b 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdump-tree-optimized -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */
 
 int *f(int *b)
 {
index b62b08ff03af7f69b50bf10f7e77ad0e47fc7b46..091a375ebd0bf9228b693cc88135db10278259d7 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O2 -fipa-pta -fno-tree-fre -fno-tree-sra -fdump-ipa-pta-details" } */
+/* { dg-options "-O2 -fipa-pta -fno-tree-fre -fno-tree-sra -fdump-ipa-pta-details -fdelete-null-pointer-checks" } */
 
 struct X {
     int i;
index bb474ff4b1bd1c48c9841c3250700afb14a507a8..9f8f2746734d4e475a5ad13c8ace9793800757cd 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-dom2" } */
+/* { dg-options "-O2 -fdump-tree-dom2 -fdelete-null-pointer-checks" } */
      
 extern void exit (int);
 extern void *ggc_alloc (__SIZE_TYPE__);
@@ -18,7 +18,7 @@ foo (int attr_kind, unsigned long offset)
     exit (0);
 }
 
-/* There should be no IF conditionals, unless target has fno-delete-null-pointer-checks  */
+/* There should be no IF conditionals, unless target disables -fdelete-null-pointer-checks  */
 /* { dg-final { scan-tree-dump-times "if " 0 "dom2" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump "if " "dom2" { target { keeps_null_pointer_checks } } } } */
      
index 1768d4523d2cc2a3b1dc3f19a21aa2ded730aacb..0be596e8e6406de5397cc2c180c5d6c67ecccf5f 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-dom2" } */
+/* { dg-options "-O2 -fdump-tree-dom2 -fdelete-null-pointer-checks" } */
      
 extern void exit (int);
 extern void *ggc_alloc (__SIZE_TYPE__);
@@ -18,7 +18,7 @@ foo (int attr_kind, unsigned long offset)
     exit (0);
 }
 
-/* There should be no IF conditionals, unless target has fno-delete-null-pointer-checks  */
+/* There should be no IF conditionals, unless target disables -fdelete-null-pointer-checks  */
 /* { dg-final { scan-tree-dump-times "if " 0 "dom2" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump "if " "dom2" { target { keeps_null_pointer_checks } } } } */
 
index 3ed98aeb857cc143e69d8fea3eab8d13d4600405..be67e4ed127de4a4af7f3ee4542d5016697e9a9a 100644 (file)
@@ -1,6 +1,6 @@
 
 /* { dg-do compile } */ 
-/* { dg-options "-O2 -fdump-tree-isolate-paths" } */
+/* { dg-options "-O2 -fdump-tree-isolate-paths -fdelete-null-pointer-checks" } */
 /* { dg-skip-if "" keeps_null_pointer_checks } */
 
 
index 912d98e224617121ab7d3806f967dd8051276629..a7e7514c5fc96bc8f241caa68ee9ab984ff059d6 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */ 
-/* { dg-options "-O2 -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */
+/* { dg-options "-O2 -fdelete-null-pointer-checks -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */
 /* { dg-skip-if "" keeps_null_pointer_checks } */
 
 
index 8dd2f2bdc2f1d8027f478d6067a6b84bd1fbf24e..0fe7e62111d3615567d545089f1a53b4702ca60c 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */ 
-/* { dg-options "-O2 -fdump-tree-isolate-paths" } */
+/* { dg-options "-O2 -fdump-tree-isolate-paths -fdelete-null-pointer-checks" } */
 /* { dg-skip-if "" keeps_null_pointer_checks } */
 
 
index d50a2b27f472fb596a5f2d2443b4c051a5b8cd13..0da4134fd06750f27856c5e58dac6d1113a76b3d 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */ 
-/* { dg-options "-O2 -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */
+/* { dg-options "-O2 -fdelete-null-pointer-checks -fisolate-erroneous-paths-attribute -fdump-tree-isolate-paths -fdump-tree-phicprop1" } */
 /* { dg-skip-if "" keeps_null_pointer_checks } */
 
 
index 131d319ae0dced3afc722215488e58ec49f0fe1f..2978413cc37cf598100e2256c278e747b63ee788 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */ 
-/* { dg-options "-O2 -fdump-tree-isolate-paths -fdump-tree-optimized" } */
+/* { dg-options "-O2 -fdelete-null-pointer-checks -fdump-tree-isolate-paths -fdump-tree-optimized" } */
 /* { dg-skip-if "" keeps_null_pointer_checks } */
 
 struct demangle_component
index e94ad5f14caf929c82fe80f2d4fc617f91d11741..18ccc604838dae8d8fafe312af7e7267d7eb28fe 100644 (file)
@@ -1,5 +1,7 @@
 /* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* { dg-options "-O2 -fdelete-null-pointer-checks" } */
+
+/* { dg-skip-if "" keeps_null_pointer_checks } */
 extern int a; /* { dg-error "declared weak after being used" } */
 int
 t()
index 1b302aedefaa3587ebf872c8bca13ab589181535..f36184b92085a92c75ec2553f6118ed0af5dd17b 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile { target { ! keeps_null_pointer_checks } } } */
-/* { dg-options "-O2 -fdump-tree-original -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-original -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
 
 extern int* f(int) __attribute__((returns_nonnull));
 extern void eliminate ();
index 3ddf48e6f005e42abfdd9f3662b785408330e75f..c49ff7a7ba3300f6cdf8078be1e7f718bef71c36 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fno-early-inlining -fdelete-null-pointer-checks" } */
 
 typedef struct {
   int code;
@@ -35,7 +35,7 @@ can_combine_p (rtx insn, rtx elt)
   return 0;
 }
 
-/* Target with fno-delete-null-pointer-checks should not fold checks */
+/* Target disabling -fdelete-null-pointer-checks should not fold checks */
 /* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
 /* { dg-final { cleanup-tree-dump "vrp1" } } */
index ce62fa3f0f930478bd2e3b493563e99776ec3107..8313f1aea788481ffc20b3fc830d0bb16578e95c 100644 (file)
@@ -4,7 +4,7 @@
    immediate successors of the basic block.  */
 
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
 
 extern void bar (int);
 
@@ -25,7 +25,7 @@ foo (int *p, int b)
   return a;
 }
 
-/* Target with fno-delete-null-pointer-checks should not fold checks */
+/* Target disabling -fdelete-null-pointer-checks should not fold checks */
 /* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
 /* { dg-final { cleanup-tree-dump "vrp1" } } */
index f924d26cca2d8bbc82d1e32fc7bccace82227199..6f96f40cbf47aac7c35f432ed860823ddda0482b 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dce1" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdump-tree-dce1 -fdelete-null-pointer-checks" } */
 
 int
 foo (int *p)
@@ -15,7 +15,7 @@ foo (int *p)
     return 0;
 }
 
-/* Target with fno-delete-null-pointer-checks should not fold checks */
+/* Target disabling -fdelete-null-pointer-checks should not fold checks */
 /* { dg-final { scan-tree-dump "Folding predicate " "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate " 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-not "b_. =" "dce1" { target { ! avr-*-* } } } } */
index 40d960d49b704e45748d8a8b7452bffab2a96642..30abc2034a53de896036526da0ff79299c50a439 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
 
 int g, h;
 
index a42edf973cb263ea59f75a517b32ee0a1af955ae..90e4cc0aeb320eac25898b18fb614fb20dfcc51a 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile { target { ! keeps_null_pointer_checks } } } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
 
 extern void eliminate (void);
 extern void* f1 (void *a, void *b) __attribute__((nonnull));
index dcfae5dd95785e1f9018f388e06d7f6e10a9df2b..f02d32a479bae20cb2dab36272a2f174cef103d5 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O -fdump-tree-alias-details" } */
+/* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */
 
 int *i;
 void __attribute__((noinline))
index e6139591ec808a8fefc50f26a95ba80de1a78e1c..b97e515ba3df2d4308365e6adb7a9562dadebd81 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O -fdump-tree-alias-details" } */
+/* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */
 
 int *i;
 void __attribute__((noinline))
index 870dcf6b19ac21ed9e258a1a35cb4d3fcccb923d..280b4b221e2ccd8a30c4e630be02977ac1aaeb93 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do run } */
-/* { dg-options "-O -fdump-tree-alias-details" } */
+/* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */
 
 int *i;
 void __attribute__((noinline))
index a4fdf89958f42d725f8405bf143e8942f7d66f31..4f4d9679481d41e233f668e12c39b69ebe920cfc 100644 (file)
@@ -1,5 +1,6 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
+/* { dg-skip-if "" keeps_null_pointer_checks } */
 
 void oof (void);
 struct basic_block_def;
index c4caeaf6c0bf857518235573381faef36f660be5..11ff47bcb0772c03636fe15bd4f73fc50d3c645d 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O1 -fdump-tree-optimized" } */
+/* { dg-options "-O1 -fdump-tree-optimized -fdelete-null-pointer-checks" } */
 static void bad_boy()
 {
 }
index 4373d524c2582895a650075e72f2867834b05d65..994c1dbb9cddd15184fdb965302f07559b6fa4ee 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1" } */
+/* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
 
 struct A
 {
@@ -20,7 +20,7 @@ foo (struct A *p, struct A *q)
   if (p)
     return x + p->b;
 }
-/* Target with fno-delete-null-pointer-checks should not fold check */
+/* Target disabling -fdelete-null-pointer-checks should not fold check */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
 /* { dg-final { cleanup-tree-dump "vrp1" } } */
index ba813f271f75dde5f8171ded738bb7c805dace48..a59a3e83bbc45ec317f819bb7704229243538fc5 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
 
 int
 foo (int i, int *p)
@@ -30,7 +30,7 @@ foo (int i, int *p)
 
   return i;
 }
-/* Target with fno-delete-null-pointer-checks should not fold checks */
+/* Target disabling -fdelete-null-pointer-checks should not fold checks */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
index b7111dbad960f5a43305f87534ca6885e931211f..9aff505357df9cf52806e973c249cca413842410 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details" } */
+/* { dg-options "-O2 -fno-tree-fre -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
 
 /* Compile with -fno-tree-fre -O2 to prevent CSEing *p.  */
 int
@@ -18,7 +18,7 @@ foo (int a, int *p)
 
   return a;
 }
-/* Target with fno-delete-null-pointer-checks should not fold checks */
+/* Target disabling -fdelete-null-pointer-checks should not fold checks */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "PREDICATE: p_.* ne_expr 0" 1 "vrp1" { target { ! keeps_null_pointer_checks } } } } */
 /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target {   keeps_null_pointer_checks } } } } */
index 7d1825f24fda058b65b8fac4687904a92af44eb6..d4014abf22b65c8089c579e650bdff7e4da4be1c 100644 (file)
@@ -1,5 +1,5 @@
 /* { dg-do compile } */
-/* { dg-options "-O2 -fdump-tree-vrp1-blocks-vops-details" } */
+/* { dg-options "-O2 -fdump-tree-vrp1-blocks-vops-details -fdelete-null-pointer-checks" } */
 
 void arf (void);
 
index c5d0ffe06e2a4a7be2a439631899bf2e14a0293c..d68b48bad21924c9355c92489a4323b11baaa0f8 100644 (file)
@@ -458,9 +458,11 @@ proc check_effective_target_trampolines { } {
 }
 
 # Return 1 if according to target_info struct and explicit target list
-# target is supposed to keep null pointer checks. This could be due to 
-# use of option fno-delete-null-pointer-checks or hardwired in target.
+# target disables -fdelete-null-pointer-checks.  Targets should return 0
+# if they simply default to -fno-delete-null-pointer-checks but obey
+# -fdelete-null-pointer-checks when passed explicitly (and tests that 
+# depend on this option should do that).
+
 proc check_effective_target_keeps_null_pointer_checks { } {
     if [target_info exists keeps_null_pointer_checks] {
       return 1