diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2005-04-10 04:00:53 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2005-04-10 04:00:53 +0000 |
commit | 46382283d57b72ccb117f1b2f3735c7e0c252870 (patch) | |
tree | 24485e56e8b36a8e92b4e868e76b61bc02192114 /gcc/loop.c | |
parent | f7d7d3b779b8ade7cef279492981705ee9b5a577 (diff) | |
download | gcc-46382283d57b72ccb117f1b2f3735c7e0c252870.zip gcc-46382283d57b72ccb117f1b2f3735c7e0c252870.tar.gz gcc-46382283d57b72ccb117f1b2f3735c7e0c252870.tar.bz2 |
re PR target/20126 (Inlined memcmp makes one argument null on entry)
gcc/ChangeLog:
PR target/20126
* loop.c (loop_givs_rescan): If replacement of DEST_ADDR failed,
set the original address pseudo to the correct value before the
original insn, if possible, and leave the insn alone, otherwise
create a new pseudo, set it and replace it in the insn.
* recog.c (validate_change_maybe_volatile): New.
* recog.h (validate_change_maybe_volatile): Declare.
gcc/testsuite/ChangeLog:
* gcc.dg/pr20126.c: New.
From-SVN: r97939
Diffstat (limited to 'gcc/loop.c')
-rw-r--r-- | gcc/loop.c | 28 |
1 files changed, 25 insertions, 3 deletions
@@ -5476,9 +5476,31 @@ loop_givs_rescan (struct loop *loop, struct iv_class *bl, rtx *reg_map) mark_reg_pointer (v->new_reg, 0); if (v->giv_type == DEST_ADDR) - /* Store reduced reg as the address in the memref where we found - this giv. */ - validate_change (v->insn, v->location, v->new_reg, 0); + { + /* Store reduced reg as the address in the memref where we found + this giv. */ + if (validate_change_maybe_volatile (v->insn, v->location, + v->new_reg)) + /* Yay, it worked! */; + /* Not replaceable; emit an insn to set the original + giv reg from the reduced giv. */ + else if (REG_P (*v->location)) + loop_insn_emit_before (loop, 0, v->insn, + gen_move_insn (*v->location, + v->new_reg)); + else + { + /* If it wasn't a reg, create a pseudo and use that. */ + rtx reg, seq; + start_sequence (); + reg = force_reg (v->mode, *v->location); + seq = get_insns (); + end_sequence (); + loop_insn_emit_before (loop, 0, v->insn, seq); + if (!validate_change_maybe_volatile (v->insn, v->location, reg)) + gcc_unreachable (); + } + } else if (v->replaceable) { reg_map[REGNO (v->dest_reg)] = v->new_reg; |