This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[tree-ssa] More dominator optimizer testcases


These are things I ran into this afternoon.  -1, -2, -4 and -5 currently
fail.  I'm currently testing the fixes for -1, -2 and -4.



        * gcc.dg/tree-ssa/20030814-1.c: New test.
        * gcc.dg/tree-ssa/20030814-2.c: New test.
        * gcc.dg/tree-ssa/20030814-3.c: New test.
        * gcc.dg/tree-ssa/20030814-4.c: New test.
        * gcc.dg/tree-ssa/20030814-5.c: New test.

Index: 20030814-1.c
===================================================================
RCS file: 20030814-1.c
diff -N 20030814-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- 20030814-1.c	15 Aug 2003 05:12:38 -0000
***************
*** 0 ****
--- 1,20 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+    
+ 
+ com(int *blah)
+ {
+   int z = *blah;
+   if (z == 256)
+     {
+       oof (z);
+       abort ();
+     }
+   return *blah;
+ }
+ 
+ /* There should be precisely one load of blah.  If there is
+    more than one, then the dominator optimizations failed.  */
+ /* { dg-final { scan-tree-dump-times "\\*blah" 1 "ssa"} } */
+   
+ 
Index: 20030814-2.c
===================================================================
RCS file: 20030814-2.c
diff -N 20030814-2.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- 20030814-2.c	15 Aug 2003 05:12:38 -0000
***************
*** 0 ****
--- 1,21 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+     
+ 
+ void
+ foo (int value)
+ {
+   switch (value)
+     {
+     case 42:
+ 	      if (value != 42)
+ 		abort ();
+     case 50:
+       blah ();
+     }
+ }
+ 
+ /* There should be no IF conditionals.  */
+ /* { dg-final { scan-tree-dump-times "if " 0 "ssa"} } */
+  
+ 
Index: 20030814-3.c
===================================================================
RCS file: 20030814-3.c
diff -N 20030814-3.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- 20030814-3.c	15 Aug 2003 05:12:38 -0000
***************
*** 0 ****
--- 1,22 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+     
+ 
+ void
+ foo (int value)
+ {
+   switch (value)
+     {
+     case 40:
+     case 42:
+ 	      if (value != 42)
+ 		abort ();
+     case 50:
+       blah ();
+     }
+ }
+ 
+ /* There should be one IF conditional.  */
+ /* { dg-final { scan-tree-dump-times "if " 1 "ssa"} } */
+  
+ 
Index: 20030814-4.c
===================================================================
RCS file: 20030814-4.c
diff -N 20030814-4.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- 20030814-4.c	15 Aug 2003 05:12:38 -0000
***************
*** 0 ****
--- 1,36 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+     
+ union tree_node;
+ typedef union tree_node *tree;
+ extern const char tree_code_type[];
+ struct tree_common
+ {
+   int code;
+ };
+ struct tree_decl 
+ {
+   long pointer_alias_set;
+ };
+ union tree_node
+ {
+   struct tree_common common;
+   struct tree_decl decl;
+ };
+ long
+ blah (decl, set)
+      tree decl;
+      long set;
+ {
+   decl->decl.pointer_alias_set = set;
+   if (tree_code_type[decl->common.code] != 'd')
+     abort ();
+   record_alias_subset (decl->decl.pointer_alias_set);
+   if (set != -1)
+     set = 0; 
+   return set;
+ }
+ 
+ /* There should be precisely one reference to pointer_alias_set.  If there is
+    more than one, then the dominator optimizations failed.  */
+ /* { dg-final { scan-tree-dump-times "pointer_alias_set" 1 "ssa"} } */
Index: 20030814-5.c
===================================================================
RCS file: 20030814-5.c
diff -N 20030814-5.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- 20030814-5.c	15 Aug 2003 05:12:38 -0000
***************
*** 0 ****
--- 1,36 ----
+ /* { dg-do compile } */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+     
+ union tree_node;
+ typedef union tree_node *tree;
+ extern const char tree_code_type[];
+ struct tree_common
+ {
+   int code;
+ };
+ struct tree_decl 
+ {
+   long pointer_alias_set;
+ };
+ union tree_node
+ {
+   struct tree_common common;
+   struct tree_decl decl;
+ };
+ long
+ blah (decl, set)
+      tree decl;
+      long set;
+ {
+   decl->decl.pointer_alias_set = oof ();;
+   if (tree_code_type[decl->common.code] != 'd')
+     abort ();
+   record_alias_subset (decl->decl.pointer_alias_set);
+   if (set != -1)
+     set = 0; 
+   return set;
+ }
+ 
+ /* There should be precisely one reference to pointer_alias_set.  If there is
+    more than one, then the dominator optimizations failed.  */
+ /* { dg-final { scan-tree-dump-times "pointer_alias_set" 1 "ssa"} } */



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]