aboutsummaryrefslogtreecommitdiff
path: root/gcc/recog.c
diff options
context:
space:
mode:
authorUros Bizjak <ubizjak@gmail.com>2012-01-15 19:03:46 +0100
committerUros Bizjak <uros@gcc.gnu.org>2012-01-15 19:03:46 +0100
commitbf63ef6c22e8d8f972e76dad2b75ef509ddbc062 (patch)
treeeca3678227b52e8d12cc35b64e4e604c44c20c09 /gcc/recog.c
parent512b60583ea250fb524bb6acabed4de0e7ff416b (diff)
downloadgcc-bf63ef6c22e8d8f972e76dad2b75ef509ddbc062.zip
gcc-bf63ef6c22e8d8f972e76dad2b75ef509ddbc062.tar.gz
gcc-bf63ef6c22e8d8f972e76dad2b75ef509ddbc062.tar.bz2
re PR rtl-optimization/51821 (64bit > 32bit conversion produces incorrect results with optimizations)
PR rtl-optimization/51821 * recog.c (peep2_find_free_register): Determine clobbered registers from insn pattern. testsuite/ChangeLog: PR rtl-optimization/51821 * gcc.dg/pr51821.c: New test. From-SVN: r183194
Diffstat (limited to 'gcc/recog.c')
-rw-r--r--gcc/recog.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/recog.c b/gcc/recog.c
index 19f00b1..8f04179 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -3038,6 +3038,7 @@ peep2_find_free_register (int from, int to, const char *class_str,
static int search_ofs;
enum reg_class cl;
HARD_REG_SET live;
+ df_ref *def_rec;
int i;
gcc_assert (from < MAX_INSNS_PER_PEEP2 + 1);
@@ -3051,12 +3052,14 @@ peep2_find_free_register (int from, int to, const char *class_str,
while (from != to)
{
- HARD_REG_SET this_live;
+ gcc_assert (peep2_insn_data[from].insn != NULL_RTX);
+
+ /* Don't use registers set or clobbered by the insn. */
+ for (def_rec = DF_INSN_DEFS (peep2_insn_data[from].insn);
+ *def_rec; def_rec++)
+ SET_HARD_REG_BIT (live, DF_REF_REGNO (*def_rec));
from = peep2_buf_position (from + 1);
- gcc_assert (peep2_insn_data[from].insn != NULL_RTX);
- REG_SET_TO_HARD_REG_SET (this_live, peep2_insn_data[from].live_before);
- IOR_HARD_REG_SET (live, this_live);
}
cl = (class_str[0] == 'r' ? GENERAL_REGS