From: Andy Hutchinson Date: Thu, 19 Jun 2008 22:08:25 +0000 (+0000) Subject: target-supports.exp (check_effective_target_keeps_null_pointer_checks): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ad0dc07d8a0be745c0366998c0164d7e0df4a1bc;p=gcc.git target-supports.exp (check_effective_target_keeps_null_pointer_checks): New function. * lib/target-supports.exp(check_effective_target_keeps_null_pointer_checks): New function. * gcc.dg/tree-ssa/20030730-1.c: Use keeps_null_pointer_checks to determine correct test response. * gcc.dg/tree-ssa/20030730-2.c: Ditto. * gcc.dg/tree-ssa/pr20701.c: Ditto. * gcc.dg/tree-ssa/pr20702.c: Ditto. * gcc.dg/tree-ssa/pr21086.c: Ditto. * gcc.dg/tree-ssa/vrp02.c:: Ditto. * gcc.dg/tree-ssa/vrp07.c:: Ditto. * gcc.dg/tree-ssa/vrp08.c:: Ditto. From-SVN: r136970 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f6c537f957b..f712d104183 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2008-06-19 Andy Hutchinson + + * lib/target-supports.exp + (check_effective_target_keeps_null_pointer_checks) : New function. + * gcc.dg/tree-ssa/20030730-1.c: Use keeps_null_pointer_checks to + determine correct test response. + * gcc.dg/tree-ssa/20030730-2.c: Ditto. + * gcc.dg/tree-ssa/pr20701.c: Ditto. + * gcc.dg/tree-ssa/pr20702.c: Ditto. + * gcc.dg/tree-ssa/pr21086.c: Ditto. + * gcc.dg/tree-ssa/vrp02.c:: Ditto. + * gcc.dg/tree-ssa/vrp07.c:: Ditto. + * gcc.dg/tree-ssa/vrp08.c:: Ditto. + 2008-06-19 Andy Hutchinson * gcc.dg/pragma-pack-4.c: Skip for AVR target. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c b/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c index ded6ef76469..f8ee97c7213 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c @@ -18,7 +18,8 @@ foo (int attr_kind, unsigned long offset) exit (0); } -/* There should be no IF conditionals. */ -/* { dg-final { scan-tree-dump-times "if " 0 "dom3" } } */ - +/* There should be no IF conditionals, unless target has fno-delete-null-pointer-checks */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3" { target { ! keeps_null_pointer_checks } } } } */ +/* { dg-final { scan-tree-dump "if " "dom3" { target { keeps_null_pointer_checks } } } } */ + /* { dg-final { cleanup-tree-dump "dom3" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c b/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c index 8b53d818d27..90359ed8cc7 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/20030730-2.c @@ -18,7 +18,8 @@ foo (int attr_kind, unsigned long offset) exit (0); } -/* There should be no IF conditionals. */ -/* { dg-final { scan-tree-dump-times "if " 0 "dom3" } } */ +/* There should be no IF conditionals, unless target has fno-delete-null-pointer-checks */ +/* { dg-final { scan-tree-dump-times "if " 0 "dom3" { target { ! keeps_null_pointer_checks } } } } */ +/* { dg-final { scan-tree-dump "if " "dom3" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { cleanup-tree-dump "dom3" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c index 6721155fc9a..d20b1022f0b 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20701.c @@ -35,5 +35,7 @@ can_combine_p (rtx insn, rtx elt) return 0; } -/* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 1 "vrp2" } } */ +/* Target with fno-delete-null-pointer-checks should not fold checks */ +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 1 "vrp2" { target { ! keeps_null_pointer_checks } } } } */ +/* { dg-final { scan-tree-dump-times "Folding predicate.*to 0" 0 "vrp2" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { cleanup-tree-dump "vrp2" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c index 0e1b4e6d3be..ce62fa3f0f9 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20702.c @@ -25,5 +25,7 @@ foo (int *p, int b) return a; } -/* { dg-final { scan-tree-dump-times "Folding predicate" 1 "vrp1"} } */ +/* Target with fno-delete-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" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c index ffaccefe94c..2409608d9da 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr21086.c @@ -15,6 +15,9 @@ foo (int *p) return 0; } -/* { dg-final { scan-tree-dump-times "Folding predicate " 1 "vrp1" } } */ -/* { dg-final { scan-tree-dump-not "b_. =" "vrp1" } } */ +/* Target with fno-delete-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 { scan-tree-dump-not "b_. =" "vrp1" { target { ! avr-*-* } } } } */ +/* { dg-final { scan-tree-dump "b_. =" "vrp1" { target { avr-*-* } } } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c index d5cd775aaaf..56fca97116c 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp02.c @@ -19,6 +19,7 @@ foo (struct A *p, struct A *q) if (p) return x + p->b; } - -/* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */ +/* Target with fno-delete-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" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c index 1bff5712bca..6584919b560 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp07.c @@ -29,8 +29,11 @@ foo (int i, int *p) return i; } - +/* Target with fno-delete-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" } } */ -/* { dg-final { scan-tree-dump-times "PREDICATE: p_\[0-9\]" 2 "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 } } } } */ + +/* { dg-final { scan-tree-dump-times "PREDICATE: p_\[0-9\]" 2 "vrp1" { target { ! keeps_null_pointer_checks } } } } */ +/* { dg-final { scan-tree-dump-times "PREDICATE: p_\[0-9\]" 1 "vrp1" { target { keeps_null_pointer_checks } } } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c index 5268e181c2c..193199fbf70 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp08.c @@ -17,7 +17,8 @@ foo (int a, int *p) return a; } - -/* { dg-final { scan-tree-dump-times "Folding predicate p_.*to 1" 1 "vrp1" } } */ -/* { dg-final { scan-tree-dump-times "PREDICATE: p_.* ne_expr 0" 1 "vrp1" } } */ +/* Target with fno-delete-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 } } } } */ /* { dg-final { cleanup-tree-dump "vrp1" } } */ diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp index 5986c7bad4b..223ee16d9ee 100644 --- a/gcc/testsuite/lib/target-supports.exp +++ b/gcc/testsuite/lib/target-supports.exp @@ -398,6 +398,20 @@ proc check_effective_target_trampolines { } { return 1 } +# 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. + +proc check_effective_target_keeps_null_pointer_checks { } { + if [target_info exists keeps_null_pointer_checks] { + return 1 + } + if { [istarget avr-*-*] } { + return 1; + } + return 0 +} + # Return true if profiling is supported on the target. proc check_profiling_available { test_what } {