This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] More optimization testcases
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 12 Aug 2003 09:58:00 -0600
- Subject: [tree-ssa] More optimization testcases
- Reply-to: law at redhat dot com
More tests for things cse finds that the dominator optimizer does not find...
* gcc.dg/tree-ssa/20030807-6.c: New test.
* gcc.dg/tree-ssa/20030807-7.c: New test.
* gcc.dg/tree-ssa/20030807-9.c: New test.
* gcc.dg/tree-ssa/20030807-11.c: New test.
Index: 20030807-11.c
===================================================================
RCS file: 20030807-11.c
diff -N 20030807-11.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- 20030807-11.c 12 Aug 2003 15:56:16 -0000
***************
*** 0 ****
--- 1,19 ----
+ /* { dg-do compile */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+
+ struct rtx_def;
+ typedef struct rtx_def *rtx;
+ struct rtx_def
+ {
+ int code;
+ };
+ foo (reg)
+ rtx reg;
+ {
+ reg->code = 42;
+ if (reg->code != 42)
+ abort ();
+ }
+
+ /* There should be no IF conditionals. */
+ /* { dg-final { scan-tree-dump-times "if " 0 "ssa"} } */
Index: 20030807-6.c
===================================================================
RCS file: 20030807-6.c
diff -N 20030807-6.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- 20030807-6.c 12 Aug 2003 15:56:16 -0000
***************
*** 0 ****
--- 1,44 ----
+ /* { dg-do compile */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+
+
+ static void
+ foo (distance, i, j)
+ int distance[13][13];
+ int i, j;
+ {
+ if (distance[i][j] < 0)
+ distance[i][0] = ((distance[i][j]) < 0 ? -(distance[i][j]) :
(distance[i][j]));
+ }
+
+ static void
+ foo2 (distance, i, j)
+ int distance[13][13];
+ int i, j;
+ {
+ if (distance[i][j] <= 0)
+ distance[i][0] = ((distance[i][j]) < 0 ? -(distance[i][j]) :
(distance[i][j]));
+ }
+
+ static void
+ foo3 (distance, i, j)
+ int distance[13][13];
+ int i, j;
+ {
+ if (distance[i][j] > 0)
+ distance[i][0] = ((distance[i][j]) < 0 ? -(distance[i][j]) :
(distance[i][j]));
+ }
+
+ static void
+ foo4 (distance, i, j)
+ double distance[13][13];
+ int i, j;
+ {
+ if (distance[i][j] >= 0)
+ distance[i][0] = ((distance[i][j]) < 0 ? -(distance[i][j]) :
(distance[i][j]));
+ }
+
+ /* There should be no ABS_EXPR. */
+ /* { dg-final { scan-tree-dump-times "ABS_EXPR " 0 "ssa"} } */
+
+
Index: 20030807-7.c
===================================================================
RCS file: 20030807-7.c
diff -N 20030807-7.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- 20030807-7.c 12 Aug 2003 15:56:16 -0000
***************
*** 0 ****
--- 1,36 ----
+ /* { dg-do compile */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+
+
+
+ union tree_node;
+ typedef union tree_node *tree;
+ struct tree_common
+ {
+ int code;
+ };
+ struct tree_list
+ {
+ tree purpose;
+ };
+ union tree_node
+ {
+ struct tree_common common;
+ struct tree_list list;
+ };
+ static void
+ simplify_condition (cond_p)
+ tree *cond_p;
+ {
+ tree decl;
+ tree cond = *cond_p;
+ if (cond->common.code != 42)
+ abort ();
+ decl = cond->list.purpose;
+ if (cond->common.code != 42)
+ abort ();
+ c_simplify_stmt (&decl);
+ }
+
+ /* There should be exactly one IF conditional. */
+ /* { dg-final { scan-tree-dump-times "if " 1 "ssa"} } */
Index: 20030807-9.c
===================================================================
RCS file: 20030807-9.c
diff -N 20030807-9.c
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- 20030807-9.c 12 Aug 2003 15:56:16 -0000
***************
*** 0 ****
--- 1,12 ----
+ /* { dg-do compile */
+ /* { dg-options "-O1 -fdump-tree-ssa" } */
+
+ static void
+ bar ()
+ {
+ const char *label2 = (*"*.L_sfnames_b" == '*') + "*.L_sfnames_b";
+ oof (label2);
+ }
+
+ /* There should be no IF conditionals. */
+ /* { dg-final { scan-tree-dump-times "if " 0 "ssa"} } */