Commit 8e8af9b7 by Richard Sandiford Committed by Richard Sandiford

fwprop.c (forward_propagate_and_simplify): After checking reg/subreg…

fwprop.c (forward_propagate_and_simplify): After checking reg/subreg combinations, check whether the modes are the same.

gcc/
	* fwprop.c (forward_propagate_and_simplify): After checking
	reg/subreg combinations, check whether the modes are the same.

From-SVN: r179287
parent a7449961
2011-09-27 Richard Sandiford <rdsandiford@googlemail.com>
* fwprop.c (forward_propagate_and_simplify): After checking
reg/subreg combinations, check whether the modes are the same.
2011-09-27 Bernd Schmidt <bernds@codesourcery.com> 2011-09-27 Bernd Schmidt <bernds@codesourcery.com>
Richard Sandiford <rdsandiford@googlemail.com> Richard Sandiford <rdsandiford@googlemail.com>
...@@ -1232,21 +1232,24 @@ forward_propagate_and_simplify (df_ref use, rtx def_insn, rtx def_set) ...@@ -1232,21 +1232,24 @@ forward_propagate_and_simplify (df_ref use, rtx def_insn, rtx def_set)
/* If def and use are subreg, check if they match. */ /* If def and use are subreg, check if they match. */
reg = DF_REF_REG (use); reg = DF_REF_REG (use);
if (GET_CODE (reg) == SUBREG if (GET_CODE (reg) == SUBREG && GET_CODE (SET_DEST (def_set)) == SUBREG)
&& GET_CODE (SET_DEST (def_set)) == SUBREG {
&& (SUBREG_BYTE (SET_DEST (def_set)) != SUBREG_BYTE (reg) if (SUBREG_BYTE (SET_DEST (def_set)) != SUBREG_BYTE (reg))
|| GET_MODE (SET_DEST (def_set)) != GET_MODE (reg))) return false;
return false; }
/* Check if the def had a subreg, but the use has the whole reg. */ /* Check if the def had a subreg, but the use has the whole reg. */
if (REG_P (reg) && GET_CODE (SET_DEST (def_set)) == SUBREG) else if (REG_P (reg) && GET_CODE (SET_DEST (def_set)) == SUBREG)
return false; return false;
/* Check if the use has a subreg, but the def had the whole reg. Unlike the /* Check if the use has a subreg, but the def had the whole reg. Unlike the
previous case, the optimization is possible and often useful indeed. */ previous case, the optimization is possible and often useful indeed. */
if (GET_CODE (reg) == SUBREG && REG_P (SET_DEST (def_set))) else if (GET_CODE (reg) == SUBREG && REG_P (SET_DEST (def_set)))
reg = SUBREG_REG (reg); reg = SUBREG_REG (reg);
/* Make sure that we can treat REG as having the same mode as the
source of DEF_SET. */
if (GET_MODE (SET_DEST (def_set)) != GET_MODE (reg))
return false;
/* Check if the substitution is valid (last, because it's the most /* Check if the substitution is valid (last, because it's the most
expensive check!). */ expensive check!). */
src = SET_SRC (def_set); src = SET_SRC (def_set);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment