diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2016-11-11 22:38:33 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2016-11-11 22:38:33 +0000 |
commit | 8b287aea3561278b4002864c0d1c29b769493448 (patch) | |
tree | d0c42b5c68c9cac41892a474b5a2eeccd1791ba7 /gcc/combine.c | |
parent | 84971f1bade1acb6b721260fb02f3740642c643e (diff) | |
download | gcc-8b287aea3561278b4002864c0d1c29b769493448.zip gcc-8b287aea3561278b4002864c0d1c29b769493448.tar.gz gcc-8b287aea3561278b4002864c0d1c29b769493448.tar.bz2 |
re PR rtl-optimization/59461 (missed zero-extension elimination in the combiner)
PR rtl-optimization/59461
* doc/rtl.texi (paradoxical subregs): Add missing word.
* combine.c (reg_nonzero_bits_for_combine): Do not discard results
in modes with precision larger than that of last_set_mode.
* rtlanal.c (nonzero_bits1) <SUBREG>: If WORD_REGISTER_OPERATIONS is
set and LOAD_EXTEND_OP is appropriate, propagate results from inner
REGs to paradoxical SUBREGs.
(num_sign_bit_copies1) <SUBREG>: Likewise. Check that the mode is not
larger than a word before invoking LOAD_EXTEND_OP on it.
From-SVN: r242326
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index 6ffa387..6b7bdd0 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -9895,18 +9895,17 @@ reg_nonzero_bits_for_combine (const_rtx x, machine_mode mode, (DF_LR_IN (ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb), REGNO (x))))) { - unsigned HOST_WIDE_INT mask = rsp->last_set_nonzero_bits; - - if (GET_MODE_PRECISION (rsp->last_set_mode) < GET_MODE_PRECISION (mode)) - /* We don't know anything about the upper bits. */ - mask |= GET_MODE_MASK (mode) ^ GET_MODE_MASK (rsp->last_set_mode); - - *nonzero &= mask; + /* Note that, even if the precision of last_set_mode is lower than that + of mode, record_value_for_reg invoked nonzero_bits on the register + with nonzero_bits_mode (because last_set_mode is necessarily integral + and HWI_COMPUTABLE_MODE_P in this case) so bits in nonzero_bits_mode + are all valid, hence in mode too since nonzero_bits_mode is defined + to the largest HWI_COMPUTABLE_MODE_P mode. */ + *nonzero &= rsp->last_set_nonzero_bits; return NULL; } tem = get_last_value (x); - if (tem) { if (SHORT_IMMEDIATES_SIGN_EXTEND) @@ -9915,7 +9914,8 @@ reg_nonzero_bits_for_combine (const_rtx x, machine_mode mode, return tem; } - else if (nonzero_sign_valid && rsp->nonzero_bits) + + if (nonzero_sign_valid && rsp->nonzero_bits) { unsigned HOST_WIDE_INT mask = rsp->nonzero_bits; |