aboutsummaryrefslogtreecommitdiff
path: root/gcc/cse.c
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>1998-04-24 13:03:42 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>1998-04-24 14:03:42 +0100
commite89d3e6fafba3bb7bfcda0e4a0096aac80200c1d (patch)
tree86b767a3086c0c9ae07f20c1dfdd8afe6fe95d6a /gcc/cse.c
parent36d86db060e77a32d2feed7267235949613cca64 (diff)
downloadgcc-e89d3e6fafba3bb7bfcda0e4a0096aac80200c1d.zip
gcc-e89d3e6fafba3bb7bfcda0e4a0096aac80200c1d.tar.gz
gcc-e89d3e6fafba3bb7bfcda0e4a0096aac80200c1d.tar.bz2
cse.c (cse_set_around_loop): Don't do optimization when new pseudos are created.
* cse.c (cse_set_around_loop): Don't do optimization when new pseudos are created. From-SVN: r19404
Diffstat (limited to 'gcc/cse.c')
-rw-r--r--gcc/cse.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/cse.c b/gcc/cse.c
index 19a02ef..ddaf689 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -8018,9 +8018,24 @@ cse_set_around_loop (x, insn, loop_start)
if (cse_check_loop_start_value
&& validate_change (insn, &SET_SRC (x),
src_elt->exp, 0))
- emit_insn_after (gen_move_insn (src_elt->exp,
- SET_DEST (set)),
- p);
+ {
+ /* If this creates new pseudos, this is unsafe,
+ because the regno of new pseudo is unsuitable
+ to index into reg_qty when cse_insn processes
+ the new insn. Therefore, if a new pseudo was
+ created, discard this optimization. */
+ int nregs = max_reg_num ();
+ rtx move
+ = gen_move_insn (src_elt->exp, SET_DEST (set));
+ if (nregs != max_reg_num ())
+ {
+ if (! validate_change (insn, &SET_SRC (x),
+ SET_SRC (set), 0))
+ abort ();
+ }
+ else
+ emit_insn_after (move, p);
+ }
break;
}
}