Hi!
Bernd in 2001 fixed handling of REG_EQUIV and attempted to fix handling of
REG_EQUAL in optimize_reg_copy_3, unfortunately for the latter it wasn't
right - p at the end of the function is no longer the setter of src_reg,
but, as we walked again forwards, insn. We don't want to drop REG_EQUAL
from insn, but from the setter.
This patch fixes it, and also, instead of dropping REG_EQUAL, tries to
replace it with sign or zero extension of it if the REG_EQUAL note was
the same as the original SET_SRC.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2010-12-08 Jakub Jelinek<jakub@redhat.com>
PR rtl-optimization/46804
* regmove.c (optimize_reg_copy_3): Look for REG_EQUAL note
on the setter of src_reg rather than on insn. If it is
equal to the setter's original SET_SRC, replace it with its
zero or sign extension instead of dropping it.
* gfortran.dg/pr46804.f90: New test.