target-supports.exp (check_effective_target_keeps_null_pointer_checks): New function.
authorAndy Hutchinson <hutchinsonandy@aim.com>
Thu, 19 Jun 2008 22:08:25 +0000 (22:08 +0000)
committerAndy Hutchinson <hutchinsonandy@gcc.gnu.org>
Thu, 19 Jun 2008 22:08:25 +0000 (22:08 +0000)
* 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

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/20030730-1.c
gcc/testsuite/gcc.dg/tree-ssa/20030730-2.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/vrp02.c
gcc/testsuite/gcc.dg/tree-ssa/vrp07.c
gcc/testsuite/gcc.dg/tree-ssa/vrp08.c
gcc/testsuite/lib/target-supports.exp

index f6c537f957b65d51460773fc05314f27cb5ae8d9..f712d104183ba558437e7ac34a389f12321d12ea 100644 (file)
@@ -1,3 +1,17 @@
+2008-06-19  Andy Hutchinson  <hutchinsonandy@aim.com>
+
+       * 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  <hutchinsonandy@aim.com>
 
        * gcc.dg/pragma-pack-4.c: Skip for AVR target.
index ded6ef764693916a381e3d080fe30ce6a73108f0..f8ee97c721324eeb2f7c7e7d7fe540d77413dc29 100644 (file)
@@ -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" } } */
index 8b53d818d27ff94786a6df810e91c684e6b83a99..90359ed8cc7dfd472aec91a2145d39ea5deb6dd3 100644 (file)
@@ -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" } } */
index 6721155fc9a251b5d30858208223de89a2ccb7fe..d20b1022f0b9fa7052223bb125f3978300e78e4d 100644 (file)
@@ -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" } } */
index 0e1b4e6d3be1458f28750d8233ef79cae55862f8..ce62fa3f0f930478bd2e3b493563e99776ec3107 100644 (file)
@@ -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" } } */
index ffaccefe94c88c0136a36159a85eb8e0d956f278..2409608d9daf3a9eba803276fc5cfb70d4b8b043 100644 (file)
@@ -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" } } */
index d5cd775aaafe13d4e48851626b4add70aff8ebb7..56fca97116ce04ba2c53bed6d38687b01305ddee 100644 (file)
@@ -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" } } */
index 1bff5712bcadba65c20f46d7a4778e5f1ee15066..6584919b560ed285fc26f2f24e2c82bff1851478 100644 (file)
@@ -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" } } */
index 5268e181c2c453d65ed78fe40ab1d07a437b6ebd..193199fbf70387cc954e5be839cd5b8dbe820567 100644 (file)
@@ -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" } } */
index 5986c7bad4b1ee0b3cf1a820a02e4343e2a38608..223ee16d9ee9fba15c8ed2c5ea0a7c2d5595977d 100644 (file)
@@ -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 } {