Commit 467d8d51 by Sandra Loosemore Committed by Sandra Loosemore

common.opt (fdelete-null-pointer-checks): Init to -1.

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
parent 100c8e9e
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> 2015-05-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65984 PR tree-optimization/65984
......
...@@ -1070,7 +1070,7 @@ Common Report Var(flag_delete_dead_exceptions) Init(0) Optimization ...@@ -1070,7 +1070,7 @@ Common Report Var(flag_delete_dead_exceptions) Init(0) Optimization
Delete dead instructions that may throw exceptions Delete dead instructions that may throw exceptions
fdelete-null-pointer-checks 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 Delete useless null pointer checks
fdevirtualize-at-ltrans fdevirtualize-at-ltrans
......
...@@ -50,3 +50,12 @@ ...@@ -50,3 +50,12 @@
/* The ELF target doesn't support the Nios II Linux ABI. */ /* The ELF target doesn't support the Nios II Linux ABI. */
#define TARGET_LINUX_ABI 0 #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
...@@ -8014,10 +8014,12 @@ Enabled by @option{-Os}. ...@@ -8014,10 +8014,12 @@ Enabled by @option{-Os}.
@item -fdelete-null-pointer-checks @item -fdelete-null-pointer-checks
@opindex fdelete-null-pointer-checks @opindex fdelete-null-pointer-checks
Assume that programs cannot safely dereference null pointers, and that 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 folding optimizations at all optimization levels. In addition, other
optimization passes in GCC use this flag to control global dataflow optimization passes in GCC use this flag to control global dataflow
analyses that eliminate useless checks for null pointers; these assume 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, that if a pointer is checked after it has already been dereferenced,
it cannot be null. it cannot be null.
...@@ -8025,9 +8027,10 @@ Note however that in some environments this assumption is not true. ...@@ -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 Use @option{-fno-delete-null-pointer-checks} to disable this optimization
for programs that depend on that behavior. for programs that depend on that behavior.
Some targets, especially embedded ones, disable this option at all levels. This option is enabled by default on most targets. On Nios II ELF, it
Otherwise it is enabled at all levels: @option{-O0}, @option{-O1}, defaults to off. On AVR and CR16, this option is completely disabled.
@option{-O2}, @option{-O3}, @option{-Os}. Passes that use the information
Passes that use the dataflow information
are enabled independently at different optimization levels. are enabled independently at different optimization levels.
@item -fdevirtualize @item -fdevirtualize
...@@ -8510,7 +8513,8 @@ This flag is enabled by default at @option{-O2} and @option{-Os}. ...@@ -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 Detect paths that trigger erroneous or undefined behavior due to
dereferencing a null pointer. Isolate those paths from the main control dereferencing a null pointer. Isolate those paths from the main control
flow and turn the statement with erroneous or undefined behavior into a trap. 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 @item -fisolate-erroneous-paths-attribute
@opindex fisolate-erroneous-paths-attribute @opindex fisolate-erroneous-paths-attribute
......
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> 2015-05-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65984 PR tree-optimization/65984
......
// PR c++/58837 // PR c++/58837
// { dg-require-effective-target c++11 } // { dg-require-effective-target c++11 }
// { dg-skip-if "" keeps_null_pointer_checks }
// { dg-options "-fdelete-null-pointer-checks" }
void f(); void f();
static_assert(f, ""); static_assert(f, "");
......
/* { dg-do compile } */ /* { 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() inline void t()
{ {
} }
......
/* { dg-do compile } */ /* { 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>. // See pr19476-5.C for a version without including <new>.
#include <new> #include <new>
......
/* { dg-do compile } */ /* { 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> #include <new>
......
/* { dg-do compile } */ /* { 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>. // See pr19476-1.C for a version that includes <new>.
......
/* { dg-do compile } */ /* { 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) int *f(int *b)
{ {
......
/* { dg-do run } */ /* { 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 { struct X {
int i; int i;
......
/* { dg-do compile } */ /* { 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 exit (int);
extern void *ggc_alloc (__SIZE_TYPE__); extern void *ggc_alloc (__SIZE_TYPE__);
...@@ -18,7 +18,7 @@ foo (int attr_kind, unsigned long offset) ...@@ -18,7 +18,7 @@ foo (int attr_kind, unsigned long offset)
exit (0); 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-times "if " 0 "dom2" { target { ! keeps_null_pointer_checks } } } } */
/* { dg-final { scan-tree-dump "if " "dom2" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump "if " "dom2" { target { keeps_null_pointer_checks } } } } */
......
/* { dg-do compile } */ /* { 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 exit (int);
extern void *ggc_alloc (__SIZE_TYPE__); extern void *ggc_alloc (__SIZE_TYPE__);
...@@ -18,7 +18,7 @@ foo (int attr_kind, unsigned long offset) ...@@ -18,7 +18,7 @@ foo (int attr_kind, unsigned long offset)
exit (0); 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-times "if " 0 "dom2" { target { ! keeps_null_pointer_checks } } } } */
/* { dg-final { scan-tree-dump "if " "dom2" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { scan-tree-dump "if " "dom2" { target { keeps_null_pointer_checks } } } } */
......
/* { dg-do compile } */ /* { 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 } */ /* { dg-skip-if "" keeps_null_pointer_checks } */
......
/* { dg-do compile } */ /* { 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 } */ /* { dg-skip-if "" keeps_null_pointer_checks } */
......
/* { dg-do compile } */ /* { 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 } */ /* { dg-skip-if "" keeps_null_pointer_checks } */
......
/* { dg-do compile } */ /* { 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 } */ /* { dg-skip-if "" keeps_null_pointer_checks } */
......
/* { dg-do compile } */ /* { 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 } */ /* { dg-skip-if "" keeps_null_pointer_checks } */
struct demangle_component struct demangle_component
......
/* { dg-do compile } */ /* { 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" } */ extern int a; /* { dg-error "declared weak after being used" } */
int int
t() t()
......
/* { dg-do compile { target { ! keeps_null_pointer_checks } } } */ /* { 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 int* f(int) __attribute__((returns_nonnull));
extern void eliminate (); extern void eliminate ();
......
/* { dg-do compile } */ /* { 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 { typedef struct {
int code; int code;
...@@ -35,7 +35,7 @@ can_combine_p (rtx insn, rtx elt) ...@@ -35,7 +35,7 @@ can_combine_p (rtx insn, rtx elt)
return 0; 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" 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 { scan-tree-dump-times "Folding predicate.*to 0" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
immediate successors of the basic block. */ immediate successors of the basic block. */
/* { dg-do compile } */ /* { 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); extern void bar (int);
...@@ -25,7 +25,7 @@ foo (int *p, int b) ...@@ -25,7 +25,7 @@ foo (int *p, int b)
return a; 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" 1 "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-times "Folding predicate" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */
/* { dg-do compile } */ /* { 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 int
foo (int *p) foo (int *p)
...@@ -15,7 +15,7 @@ foo (int *p) ...@@ -15,7 +15,7 @@ foo (int *p)
return 0; 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 "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-times "Folding predicate " 0 "vrp1" { target { keeps_null_pointer_checks } } } } */
/* { dg-final { scan-tree-dump-not "b_. =" "dce1" { target { ! avr-*-* } } } } */ /* { dg-final { scan-tree-dump-not "b_. =" "dce1" { target { ! avr-*-* } } } } */
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp1" } */ /* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
int g, h; int g, h;
......
/* { dg-do compile { target { ! keeps_null_pointer_checks } } } */ /* { 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 eliminate (void);
extern void* f1 (void *a, void *b) __attribute__((nonnull)); extern void* f1 (void *a, void *b) __attribute__((nonnull));
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O -fdump-tree-alias-details" } */ /* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */
int *i; int *i;
void __attribute__((noinline)) void __attribute__((noinline))
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O -fdump-tree-alias-details" } */ /* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */
int *i; int *i;
void __attribute__((noinline)) void __attribute__((noinline))
......
/* { dg-do run } */ /* { dg-do run } */
/* { dg-options "-O -fdump-tree-alias-details" } */ /* { dg-options "-O -fdump-tree-alias-details -fdelete-null-pointer-checks" } */
int *i; int *i;
void __attribute__((noinline)) void __attribute__((noinline))
......
/* { dg-do compile } */ /* { 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); void oof (void);
struct basic_block_def; struct basic_block_def;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O1 -fdump-tree-optimized" } */ /* { dg-options "-O1 -fdump-tree-optimized -fdelete-null-pointer-checks" } */
static void bad_boy() static void bad_boy()
{ {
} }
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp1" } */ /* { dg-options "-O2 -fdump-tree-vrp1 -fdelete-null-pointer-checks" } */
struct A struct A
{ {
...@@ -20,7 +20,7 @@ foo (struct A *p, struct A *q) ...@@ -20,7 +20,7 @@ foo (struct A *p, struct A *q)
if (p) if (p)
return x + p->b; 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" 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 { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */
/* { dg-final { cleanup-tree-dump "vrp1" } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-vrp1-details" } */ /* { dg-options "-O2 -fdump-tree-vrp1-details -fdelete-null-pointer-checks" } */
int int
foo (int i, int *p) foo (int i, int *p)
...@@ -30,7 +30,7 @@ foo (int i, int *p) ...@@ -30,7 +30,7 @@ foo (int i, int *p)
return i; 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 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" 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 } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 0" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */
......
/* { dg-do compile } */ /* { 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. */ /* Compile with -fno-tree-fre -O2 to prevent CSEing *p. */
int int
...@@ -18,7 +18,7 @@ foo (int a, int *p) ...@@ -18,7 +18,7 @@ foo (int a, int *p)
return a; 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 "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 "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 } } } } */ /* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 0 "vrp1" { target { keeps_null_pointer_checks } } } } */
......
/* { dg-do compile } */ /* { 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); void arf (void);
......
...@@ -458,8 +458,10 @@ proc check_effective_target_trampolines { } { ...@@ -458,8 +458,10 @@ proc check_effective_target_trampolines { } {
} }
# Return 1 if according to target_info struct and explicit target list # 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 # target disables -fdelete-null-pointer-checks. Targets should return 0
# use of option fno-delete-null-pointer-checks or hardwired in target. # 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 { } { proc check_effective_target_keeps_null_pointer_checks { } {
if [target_info exists keeps_null_pointer_checks] { if [target_info exists keeps_null_pointer_checks] {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment