On Wed, 2021-03-03 at 11:34 -0700, Jeff Law wrote: > > > On 3/2/21 3:37 PM, Ilya Leoshkevich via Gcc-patches wrote: > > Bootstrapped and regtested on x86_64-redhat-linux, ppc64le-redhat- > > linux > > and s390x-redhat-linux. Ok for master? > > > > > > > > Commit efb6bc55a93a ("fwprop: Allow (subreg (mem)) > > simplifications") > > introduced a check that was supposed to look at the propagated > > def's > > number of uses. It uses insn_info::num_uses (), which in reality > > returns the number of uses def's insn has. The whole change > > therefore > > works only by accident. > > > > Fix by looking at def_info's uses instead of insn_info's uses. > > This > > requires passing around def_info instead of insn_info. > > > > gcc/ChangeLog: > > > > 2021-03-02 Ilya Leoshkevich <i...@linux.ibm.com> > > > > * fwprop.c (def_has_single_use_p): New function. > > (fwprop_propagation::fwprop_propagation): Look at > > def_info's uses. > > (try_fwprop_subst_note): Use def_info instead of insn_info. > > (try_fwprop_subst_pattern): Likewise. > > (try_fwprop_subst_notes): Likewise. > > (try_fwprop_subst): Likewise. > > (forward_propagate_subreg): Likewise. > > (forward_propagate_and_simplify): Likewise. > > (forward_propagate_into): Likewise. > > * iterator-utils.h (single_element_p): New function. > Given we're well into stage4, I'd recommend deferring to gcc-12 > unless > this fixes a code correctness issue. > > Jeff >
Fortunately the issue here is not a miscompilation, but it's still a regression: on s390 small functions that use long doubles get a number of useless load/stores as well as a stack frame, where none was required before. Basically, the same issue efb6bc55a93a failed to fully fix due to the num_uses() / nondebug_insn_uses() mixup.