diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-02-08 16:19:02 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-02-08 16:19:02 +0100 |
commit | 5df813131d18e4db50fb4f9c940ff782b8496a94 (patch) | |
tree | 91f45af991fea54d16e73e0b3d43e76d6f062c09 /gcc/lra-constraints.c | |
parent | 3434c119a309db4ff991d50b6ebe25a017b58cd7 (diff) | |
download | gcc-5df813131d18e4db50fb4f9c940ff782b8496a94.zip gcc-5df813131d18e4db50fb4f9c940ff782b8496a94.tar.gz gcc-5df813131d18e4db50fb4f9c940ff782b8496a94.tar.bz2 |
re PR rtl-optimization/56195 (Error: incorrect register `%rdi' used with `l' suffix (at -O2))
PR rtl-optimization/56195
* lra-constraints.c (get_reload_reg): Don't reuse regs
if they have smaller mode than requested, if they have
wider mode than requested, try to return a SUBREG.
* gcc.dg/torture/pr56195.c: New test.
From-SVN: r195891
Diffstat (limited to 'gcc/lra-constraints.c')
-rw-r--r-- | gcc/lra-constraints.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index af68c3a..13420eb 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -421,8 +421,20 @@ get_reload_reg (enum op_type type, enum machine_mode mode, rtx original, if (rtx_equal_p (curr_insn_input_reloads[i].input, original) && in_class_p (curr_insn_input_reloads[i].reg, rclass, &new_class)) { - *result_reg = curr_insn_input_reloads[i].reg; - regno = REGNO (*result_reg); + rtx reg = curr_insn_input_reloads[i].reg; + regno = REGNO (reg); + /* If input is equal to original and both are VOIDmode, + GET_MODE (reg) might be still different from mode. + Ensure we don't return *result_reg with wrong mode. */ + if (GET_MODE (reg) != mode) + { + if (GET_MODE_SIZE (GET_MODE (reg)) < GET_MODE_SIZE (mode)) + continue; + reg = lowpart_subreg (mode, reg, GET_MODE (reg)); + if (reg == NULL_RTX || GET_CODE (reg) != SUBREG) + continue; + } + *result_reg = reg; if (lra_dump_file != NULL) { fprintf (lra_dump_file, " Reuse r%d for reload ", regno); |