diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-10-14 19:29:18 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-10-14 19:29:18 +0000 |
commit | 6e74642b2c37305436269a8c036f1519b4c8c111 (patch) | |
tree | 15fe92fb736ec7716ce5d0604100a38f2b553ee9 /gcc/loop-unroll.c | |
parent | b5afa20284b164fdfaf04801361748076a50a928 (diff) | |
download | gcc-6e74642b2c37305436269a8c036f1519b4c8c111.zip gcc-6e74642b2c37305436269a8c036f1519b4c8c111.tar.gz gcc-6e74642b2c37305436269a8c036f1519b4c8c111.tar.bz2 |
re PR rtl-optimization/54919 (gcc.dg/torture/pr54877.c FAILs with -fvariable-expansion-in-unroller)
gcc/
PR rtl-optimization/54919
* loop-unroll.c (struct var_to_expand): Remove accum_pos field.
(analyze_insn_to_expand_var): Do not record accum_pos.
(expand_var_during_unrolling): Use validate_replace_rtx_group to
perform replacement of all references to SET_DEST (set) with the
new register, including references in REG_EQUAL notes.
(insert_var_expansion_initialization): Insert initializatio insns
at the bottom of the pre-header of the loop.
testsuite/
PR rtl-optimization/54919
* gcc.dg/pr54919.c: New testcase.
From-SVN: r192439
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r-- | gcc/loop-unroll.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 5350ee0..0dd8b0a 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -100,10 +100,6 @@ struct var_to_expand the accumulator. If REUSE_EXPANSION is 0 reuse the original accumulator. Else use var_expansions[REUSE_EXPANSION - 1]. */ - unsigned accum_pos; /* The position in which the accumulator is placed in - the insn src. For example in x = x + something - accum_pos is 0 while in x = something + x accum_pos - is 1. */ }; /* Information about optimization applied in @@ -1763,7 +1759,6 @@ analyze_insn_to_expand_var (struct loop *loop, rtx insn) ves->op = GET_CODE (src); ves->expansion_count = 0; ves->reuse_expansion = 0; - ves->accum_pos = accum_pos; return ves; } @@ -2123,9 +2118,7 @@ expand_var_during_unrolling (struct var_to_expand *ve, rtx insn) else new_reg = get_expansion (ve); - validate_change (insn, &SET_DEST (set), new_reg, 1); - validate_change (insn, &XEXP (SET_SRC (set), ve->accum_pos), new_reg, 1); - + validate_replace_rtx_group (SET_DEST (set), new_reg, insn); if (apply_change_group ()) if (really_new_expansion) { @@ -2165,7 +2158,7 @@ static void insert_var_expansion_initialization (struct var_to_expand *ve, basic_block place) { - rtx seq, var, zero_init, insn; + rtx seq, var, zero_init; unsigned i; enum machine_mode mode = GET_MODE (ve->reg); bool honor_signed_zero_p = HONOR_SIGNED_ZEROS (mode); @@ -2205,11 +2198,7 @@ insert_var_expansion_initialization (struct var_to_expand *ve, seq = get_insns (); end_sequence (); - insn = BB_HEAD (place); - while (!NOTE_INSN_BASIC_BLOCK_P (insn)) - insn = NEXT_INSN (insn); - - emit_insn_after (seq, insn); + emit_insn_after (seq, BB_END (place)); } /* Combine the variable expansions at the loop exit. PLACE is the |