https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78660
YunQiang Su <syq at debian dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |syq at debian dot org --- Comment #6 from YunQiang Su <syq at debian dot org> --- With revert some change, with patch: Index: gcc-7-7-20161217/src/gcc/combine.c =================================================================== --- gcc-7-7-20161217.orig/src/gcc/combine.c +++ gcc-7-7-20161217/src/gcc/combine.c @@ -9972,13 +9972,13 @@ reg_nonzero_bits_for_combine (const_rtx (DF_LR_IN (ENTRY_BLOCK_PTR_FOR_FN (cfun)->next_bb), REGNO (x))))) { - /* 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; + 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; return NULL; }