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] Another optimization test


Whee, another optimization test.  We currently fail all three subtests.
At the root of the problem is we have two different types for the
loads of ->common.code which prevents us from eliminating any of the
redundancies and determining the second IF is redundant with the first
one.  Ugh.


        * gcc.dg/tree-ssa/20030729-1.c: New test.

Index: gcc.dg/tree-ssa/20030729-1.c
===================================================================
RCS file: gcc.dg/tree-ssa/20030729-1.c
diff -N gcc.dg/tree-ssa/20030729-1.c
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gcc.dg/tree-ssa/20030729-1.c	29 Jul 2003 20:58:12 -0000
***************
*** 0 ****
--- 1,55 ----
+ /* { dg-do compile */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+ 
+ union tree_node;
+ typedef union tree_node *tree;
+ 
+ 
+ enum tree_code
+ {
+   SET_TYPE,
+   RECORD_TYPE,
+   LAST_AND_UNUSED_TREE_CODE
+ };
+ extern const char tree_code_type[];
+ 
+ struct tree_common
+ {
+ 
+   enum tree_code code:8;
+ };
+ 
+ 
+ 
+ 
+ 
+ union tree_node
+ {
+   struct tree_common common;
+ };
+ 
+ readonly_fields_p (type)
+      tree type;
+ {
+ 
+   if (type->common.code != RECORD_TYPE)
+     return;
+ 
+   if (tree_code_type[type->common.code] != 't')
+     abort ();
+ 
+   return;
+ }
+ 
+ /* A good optimizer would realize that the cast to (unsigned int) is
+    useless as the earlier cast of the same value ot (unsigned char) will
+    always produce the same result.  */
+ /* { dg-final { scan-tree-dump-times "\\(unsigned int\\)" 0 "ssa"} } */
+  
+ /* There should be one load of ->common.code.  We currently fail this
+    because we load from ->common.code using different types.  */
+ /* { dg-final { scan-tree-dump-times "common\.code" 1 "ssa"} } */
+ 
+ /* And there should be a single conditional since the second conditional
+    is redundant with the first.  */
+ /* { dg-final { scan-tree-dump-times "if " 1 "ssa"} } */



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