From: dnovillo Date: Wed, 11 May 2005 02:24:44 +0000 (+0000) Subject: * tree-optimize.c (init_tree_optimization_passes): Re-organize X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=4ebb982c4f3234ec17f87244e9e827288fdeb24d * tree-optimize.c (init_tree_optimization_passes): Re-organize optimization passes to do an initial batch of scalar cleanups. testsuite/ChangeLog * gcc.dg/pr18501.c: XFAIL. * gcc.dg/tree-ssa/loop-4.c: Fix expected pattern. * gcc.dg/tree-ssa/pr20913.c: Change to link-time test. * gcc.dg/tree-ssa/ssa-ccp-2.c: Change to a .optimized scan. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. * gcc.dg/tree-ssa/ssa-dom-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Change to a .fre scan. * gcc.dg/tree-ssa/ssa-pre-8.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99558 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8a1827fc99d..cda2fc7dbf4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-05-10 Diego Novillo + + * tree-optimize.c (init_tree_optimization_passes): Re-organize + optimization passes to do an initial batch of scalar cleanups. + 2005-05-10 Ian Lance Taylor * read-rtl.c (struct macro_traverse_data): Define. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 199e9ab98d2..8e73d94f797 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,15 @@ +2005-05-10 Diego Novillo + + * gcc.dg/pr18501.c: XFAIL. + * gcc.dg/tree-ssa/loop-4.c: Fix expected pattern. + * gcc.dg/tree-ssa/pr20913.c: Change to link-time test. + * gcc.dg/tree-ssa/ssa-ccp-2.c: Change to a .optimized scan. + * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. + * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. + * gcc.dg/tree-ssa/ssa-dom-ccp-1.c: Likewise. + * gcc.dg/tree-ssa/ssa-pre-7.c: Change to a .fre scan. + * gcc.dg/tree-ssa/ssa-pre-8.c: Likewise. + 2005-05-10 Tobias Schl"uter PR fortran/20178 diff --git a/gcc/testsuite/gcc.dg/pr18501.c b/gcc/testsuite/gcc.dg/pr18501.c index bcd20717f9e..8794486eea8 100644 --- a/gcc/testsuite/gcc.dg/pr18501.c +++ b/gcc/testsuite/gcc.dg/pr18501.c @@ -9,7 +9,7 @@ int something (void); void bitmap_print_value_set (void) { - unsigned first; /* { dg-warning "may be used" "conditional in loop" } */ + unsigned first; /* { dg-warning "may be used" "conditional in loop" { xfail *-*-* } } */ for (; bmp_iter_set (); ) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/loop-4.c b/gcc/testsuite/gcc.dg/tree-ssa/loop-4.c index 147a343eff0..6a6b97d9925 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/loop-4.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/loop-4.c @@ -32,9 +32,9 @@ void xxx(void) -- induction variable with base 0, the memory access of form *(iv + &arr_base[0].y) = ... - In any case, we should not have 'arr_base.[^0].* =' */ + In any case, we should not have 'arr_base[.*] =' */ -/* { dg-final { scan-tree-dump-times "arr_base.\[^0\]\[^\\n\\r\]*=" 0 "vars" } } */ +/* { dg-final { scan-tree-dump-times "arr_base\[.*\]\.y =" 0 "vars" } } */ /* And the original induction variable should be eliminated. */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr20913.c b/gcc/testsuite/gcc.dg/tree-ssa/pr20913.c index 43abc81c81c..fb5461a2609 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr20913.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr20913.c @@ -2,8 +2,8 @@ COPY-PROP did not fold COND_EXPR, blocking some copy propagation opportunities. */ -/* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-copyprop1-details" } */ +/* { dg-do link } */ +/* { dg-options "-O2 -fno-tree-dominator-opts" } */ int foo (int a, int b, int c, int d) @@ -14,13 +14,21 @@ foo (int a, int b, int c, int d) if (a == b) x = c; else - x = d; + { + link_error (); + x = d; + } if (x == c) return a; else - return b; + { + link_error (); + return b; + } } -/* { dg-final { scan-tree-dump-times "with if \\(1\\)" 2 "copyprop1"} } */ -/* { dg-final { cleanup-tree-dump "copyprop1" } } */ +main() +{ + foo (1, 2, 3, 4); +} diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-2.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-2.c index 4c7e36a8f9e..19975a39215 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-2.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-store_ccp" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ extern void link_error (void); @@ -168,5 +168,5 @@ int test99999 (void) /* There should be not link_error calls, if there is any the optimization has failed */ -/* { dg-final { scan-tree-dump-times "link_error" 0 "store_ccp"} } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-7.c index 3898ce6fa7a..b3497413064 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-store_ccp" } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ extern void link_error (void); @@ -23,5 +23,5 @@ int test7 (int a) /* There should be not link_error calls, if there is any the optimization has failed */ -/* { dg-final { scan-tree-dump-times "link_error" 0 "store_ccp"} } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-9.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-9.c index d9b41e6059a..af23f8bebd9 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-9.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-ccp-9.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-store_ccp" } */ +/* { dg-options "-O1 -fdump-tree-optimized" } */ /* Check that cprop works for assignments to array elements and structs. */ @@ -51,5 +51,5 @@ test99999 (int *arr, int j) /* There should be no link_error calls, if there is any, the optimization has failed */ -/* { dg-final { scan-tree-dump-times "link_error" 0 "store_ccp"} } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-ccp-1.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-ccp-1.c index 9aacbcb2746..b2bcd06bedb 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-ccp-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-dom-ccp-1.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fdump-tree-dom1-details" } */ +/* { dg-options "-O2 -fdump-tree-optimized" } */ int t(int a) __attribute__ ((const)); void abort (void); int @@ -14,5 +14,5 @@ ccp(int b) return a; } /* We should propagate constant 4 into return. */ -/* { dg-final { scan-tree-dump-times "Replaced.*with constant '4'" 1 "dom1"} } */ -/* { dg-final { cleanup-tree-dump "dom1" } } */ +/* { dg-final { scan-tree-dump-times "return 4" 1 "optimized"} } */ +/* { dg-final { cleanup-tree-dump "optimized" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c index 642c36cbf8c..c87f62e69c6 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-7.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-pre-stats" } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-fre-stats" } */ int foo (int *array) { @@ -8,5 +8,5 @@ foo (int *array) return 0; } /* We should eliminate one address calculation, and one load. */ -/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre"} } */ -/* { dg-final { cleanup-tree-dump "pre" } } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "fre"} } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-8.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-8.c index 2f6393cf16d..a6535fb4013 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-pre-8.c @@ -1,5 +1,5 @@ /* { dg-do compile } */ -/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-pre-stats" } */ +/* { dg-options "-O2 -fno-tree-dominator-opts -fdump-tree-fre-stats" } */ struct s { int *n; }; @@ -17,5 +17,5 @@ foo (__SIZE_TYPE__ i, struct s *array) return 0; } /* We should eliminate two address calculations, one cast, and one load. */ -/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "pre"} } */ -/* { dg-final { cleanup-tree-dump "pre" } } */ +/* { dg-final { scan-tree-dump-times "Eliminated: 4" 1 "fre"} } */ +/* { dg-final { cleanup-tree-dump "fre" } } */ diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index 6b1d35554f4..6e07a2b504f 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -364,12 +364,17 @@ init_tree_optimization_passes (void) NEXT_PASS (pass_may_alias); NEXT_PASS (pass_rename_ssa_copies); NEXT_PASS (pass_early_warn_uninitialized); - NEXT_PASS (pass_dce); - NEXT_PASS (pass_dominator); - NEXT_PASS (pass_copy_prop); + + /* Initial scalar cleanups. */ + NEXT_PASS (pass_ccp); + NEXT_PASS (pass_fre); NEXT_PASS (pass_dce); NEXT_PASS (pass_forwprop); NEXT_PASS (pass_vrp); + NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_dce); + NEXT_PASS (pass_dominator); + NEXT_PASS (pass_merge_phi); NEXT_PASS (pass_phiopt); NEXT_PASS (pass_may_alias); @@ -403,6 +408,7 @@ init_tree_optimization_passes (void) NEXT_PASS (pass_loop); NEXT_PASS (pass_dominator); NEXT_PASS (pass_copy_prop); + NEXT_PASS (pass_dce); /* FIXME: If DCE is not run before checking for uninitialized uses, we may get false warnings (e.g., testsuite/gcc.dg/uninit-5.c). However, this also causes us to misdiagnose cases that should be