summaryrefslogtreecommitdiff
path: root/gcc/loop-invariant.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-12 00:09:48 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-11-12 00:09:48 +0000
commite363ebc754afc7a081a40a061e6bad65c3e91f0f (patch)
treeb4896826fd17ca2498002a932d89a1fcdaf6e28f /gcc/loop-invariant.c
parent31fa6e5f6f71d7919a72e927647da7612525819c (diff)
downloadgcc-e363ebc754afc7a081a40a061e6bad65c3e91f0f.tar.gz
* loop-invariant.c (move_loop_invariants): Fix a thinko in the
previous checkin. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@106809 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop-invariant.c')
-rw-r--r--gcc/loop-invariant.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index dc35aceed3b..a909e64989d 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -796,9 +796,22 @@ move_invariant_reg (struct loop *loop, unsigned invno, struct df *df)
reg = gen_reg_rtx (GET_MODE (SET_DEST (set)));
df_pattern_emit_after (df, gen_move_insn (SET_DEST (set), reg),
BLOCK_FOR_INSN (inv->insn), inv->insn);
- df_pattern_emit_after (df, gen_move_insn (reg, SET_SRC (set)),
- preheader, BB_END (preheader));
- df_insn_delete (df, BLOCK_FOR_INSN (inv->insn), inv->insn);
+
+ /* If the SET_DEST of the invariant insn is a reg, we can just move
+ the insn out of the loop. Otherwise, we have to use gen_move_insn
+ to let emit_move_insn produce a valid instruction stream. */
+ if (REG_P (SET_DEST (set)))
+ {
+ SET_DEST (set) = reg;
+ reorder_insns (inv->insn, inv->insn, BB_END (preheader));
+ df_insn_modify (df, preheader, inv->insn);
+ }
+ else
+ {
+ df_pattern_emit_after (df, gen_move_insn (reg, SET_SRC (set)),
+ preheader, BB_END (preheader));
+ df_insn_delete (df, BLOCK_FOR_INSN (inv->insn), inv->insn);
+ }
/* Replace the uses we know to be dominated. It saves work for copy
propagation, and also it is necessary so that dependent invariants