Index: doc/invoke.texi =================================================================== --- doc/invoke.texi (revision 122978) +++ doc/invoke.texi (working copy) @@ -342,7 +342,7 @@ -fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol -fno-split-wide-types -fstack-protector -fstack-protector-all @gol -fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol --funroll-all-loops -funroll-loops -fpeel-loops @gol +-funroll-all-loops -funroll-loops -fpeel-loops -ftree-complete-unroll @gol -fsplit-ivs-in-unroller -funswitch-loops @gol -fvariable-expansion-in-unroller @gol -ftree-pre -ftree-ccp -ftree-dce -ftree-loop-optimize @gol @@ -5348,6 +5348,11 @@ @option{-funroll-all-loops} implies the same options as @option{-funroll-loops}, +@item -ftree-complete-unroll +@opindex ftree-complete-unroll +Perform complete unrolling for loops. + + @item -fsplit-ivs-in-unroller @opindex -fsplit-ivs-in-unroller Enables expressing of values of induction variables in later iterations Index: testsuite/gcc.dg/tree-ssa/20030917-1.c =================================================================== --- testsuite/gcc.dg/tree-ssa/20030917-1.c (revision 122978) +++ testsuite/gcc.dg/tree-ssa/20030917-1.c (working copy) @@ -15,5 +15,5 @@ } /* The argument to "foo" should be a variable, not a constant. */ -/* { dg-final { scan-tree-dump-times "foo .defval" 1 "store_ccp"} } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "foo .defval" 1 "store_ccp1"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/tree-ssa/ssa-ccp-1.c =================================================================== --- testsuite/gcc.dg/tree-ssa/ssa-ccp-1.c (revision 122978) +++ testsuite/gcc.dg/tree-ssa/ssa-ccp-1.c (working copy) @@ -71,5 +71,5 @@ /* 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 "store_ccp1"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/tree-ssa/pr21574.c =================================================================== --- testsuite/gcc.dg/tree-ssa/pr21574.c (revision 122978) +++ testsuite/gcc.dg/tree-ssa/pr21574.c (working copy) @@ -9,5 +9,5 @@ } /* The store to *p should be propagated to the return statement. */ -/* { dg-final { scan-tree-dump-times "return 0" 1 "store_ccp" } } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "return 0" 1 "store_ccp1" } } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/tree-ssa/20030917-3.c =================================================================== --- testsuite/gcc.dg/tree-ssa/20030917-3.c (revision 122978) +++ testsuite/gcc.dg/tree-ssa/20030917-3.c (working copy) @@ -20,5 +20,5 @@ /* The argument to "printf" should be a constant, not a variable. */ -/* { dg-final { scan-tree-dump-times "printf.*, 0" 1 "store_ccp"} } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "printf.*, 0" 1 "store_ccp1"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/tree-ssa/ssa-ccp-3.c =================================================================== --- testsuite/gcc.dg/tree-ssa/ssa-ccp-3.c (revision 122978) +++ testsuite/gcc.dg/tree-ssa/ssa-ccp-3.c (working copy) @@ -131,5 +131,5 @@ optimization has failed */ /* ??? While we indeed don't handle some of these, a couple of the restrict tests are incorrect. */ -/* { dg-final { scan-tree-dump-times "link_error" 0 "store_ccp" { xfail *-*-* } } } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "link_error" 0 "store_ccp1" { xfail *-*-* } } } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/tree-ssa/pr14841.c =================================================================== --- testsuite/gcc.dg/tree-ssa/pr14841.c (revision 122978) +++ testsuite/gcc.dg/tree-ssa/pr14841.c (working copy) @@ -25,5 +25,5 @@ link_error (); } -/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "store_ccp"} } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "Folded statement: if " 1 "store_ccp1"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/tree-ssa/20030731-2.c =================================================================== --- testsuite/gcc.dg/tree-ssa/20030731-2.c (revision 122978) +++ testsuite/gcc.dg/tree-ssa/20030731-2.c (working copy) @@ -13,5 +13,5 @@ /* There should be only one IF conditional since the first does nothing useful. */ -/* { dg-final { scan-tree-dump-times "if " 1 "store_ccp"} } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "if " 1 "store_ccp1"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/tree-ssa/20040721-1.c =================================================================== --- testsuite/gcc.dg/tree-ssa/20040721-1.c (revision 122978) +++ testsuite/gcc.dg/tree-ssa/20040721-1.c (working copy) @@ -24,5 +24,5 @@ } /* There should be no G on the RHS of an assignment. */ -/* { dg-final { scan-tree-dump-times "= G;" 0 "store_ccp"} } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "= G;" 0 "store_ccp1"} } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/pr23911.c =================================================================== --- testsuite/gcc.dg/pr23911.c (revision 122978) +++ testsuite/gcc.dg/pr23911.c (working copy) @@ -17,6 +17,6 @@ /* After store_ccp, there should not be any assignments from real or imaginary parts anymore. The constants should be loaded from b and propagated into the elements of a. */ -/* { dg-final { scan-tree-dump-times "= CR" 0 "store_ccp" } } */ -/* { dg-final { scan-tree-dump-times "= CI" 0 "store_ccp" } } */ -/* { dg-final { cleanup-tree-dump "store_ccp" } } */ +/* { dg-final { scan-tree-dump-times "= CR" 0 "store_ccp1" } } */ +/* { dg-final { scan-tree-dump-times "= CI" 0 "store_ccp1" } } */ +/* { dg-final { cleanup-tree-dump "store_ccp*" } } */ Index: testsuite/gcc.dg/vect/vect.exp =================================================================== --- testsuite/gcc.dg/vect/vect.exp (revision 122978) +++ testsuite/gcc.dg/vect/vect.exp (working copy) @@ -23,7 +23,7 @@ set DEFAULT_VECTCFLAGS "" # These flags are used for all targets. -lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" +lappend DEFAULT_VECTCFLAGS "-O2" "-ftree-vectorize" "-fno-tree-complete-unroll" # If the target system supports vector instructions, the default action # for a test is 'run', otherwise it's 'compile'. Save current default. Index: tree-ssa-loop.c =================================================================== --- tree-ssa-loop.c (revision 122978) +++ tree-ssa-loop.c (working copy) @@ -376,7 +376,7 @@ static bool gate_tree_complete_unroll (void) { - return true; + return (flag_tree_complete_unroll); } struct tree_opt_pass pass_complete_unroll = Index: common.opt =================================================================== --- common.opt (revision 122978) +++ common.opt (working copy) @@ -1041,6 +1041,10 @@ Common Report Var(flag_unroll_all_loops) Perform loop unrolling for all loops +ftree-complete-unroll +Common Report Var(flag_tree_complete_unroll) Init(1) +Perform complete unrolling for loops + ; Nonzero means that loop optimizer may assume that the induction variables ; that control loops do not overflow and that the loops with nontrivial ; exit condition are not infinite Index: passes.c =================================================================== --- passes.c (revision 122978) +++ passes.c (working copy) @@ -591,6 +591,11 @@ NEXT_PASS (pass_linear_transform); NEXT_PASS (pass_iv_canon); NEXT_PASS (pass_if_conversion); + NEXT_PASS (pass_complete_unroll); + NEXT_PASS (pass_ccp); + NEXT_PASS (pass_store_ccp); + NEXT_PASS (pass_dse); + NEXT_PASS (pass_dce); NEXT_PASS (pass_vectorize); { struct tree_opt_pass **p = &pass_vectorize.sub; @@ -600,7 +605,6 @@ /* NEXT_PASS (pass_may_alias) cannot be done again because the vectorizer creates alias relations that are not supported by pass_may_alias. */ - NEXT_PASS (pass_complete_unroll); NEXT_PASS (pass_loop_prefetch); NEXT_PASS (pass_iv_optimize); NEXT_PASS (pass_tree_loop_done);