Hi all, I now committed this, with changelog
PR rtl-optimization/78232 * combine.c (try_combine): Add a big comment about why reusing i2dest is undesirable. (change_zero_ext): Do not call simplify_gen_binary, do the simplifications manually. and the patch adds --- a/gcc/combine.c +++ b/gcc/combine.c @@ -3560,6 +3560,15 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, { machine_mode new_mode = GET_MODE (SET_DEST (newpat)); + /* ??? Reusing i2dest without resetting the reg_stat entry for it + (temporarily, until we are committed to this instruction + combination) does not work: for example, any call to nonzero_bits + on the register (from a splitter in the MD file, for example) + will get the old information, which is invalid. + + Since nowadays we can create registers during combine just fine, + we should just create a new one here, not reuse i2dest. */ + /* First try to split using the original register as a scratch register. */ parallel = gen_rtx_PARALLEL (VOIDmode,