diff options
author | Segher Boessenkool <segher@kernel.crashing.org> | 2016-11-24 00:30:38 +0100 |
---|---|---|
committer | Segher Boessenkool <segher@gcc.gnu.org> | 2016-11-24 00:30:38 +0100 |
commit | 469585df2d22f325c50e1614d397a0a38b29df6f (patch) | |
tree | 4f7438022bdf1a4e4449696b64295c5916e59252 /gcc/combine.c | |
parent | 188a20911952c78871ddbfc645f5e4be8a711e06 (diff) | |
download | gcc-469585df2d22f325c50e1614d397a0a38b29df6f.zip gcc-469585df2d22f325c50e1614d397a0a38b29df6f.tar.gz gcc-469585df2d22f325c50e1614d397a0a38b29df6f.tar.bz2 |
combine: Query can_change_dest_mode before changing dest mode
As reported in https://gcc.gnu.org/ml/gcc-patches/2016-11/msg02388.html .
Changing the mode of a hard register can lead to problems, or at least
it can make worse code if the result will need reloads.
* combine.c (change_zero_ext): Only change the mode of a hard register
destination if can_change_dest_mode holds for that.
From-SVN: r242812
Diffstat (limited to 'gcc/combine.c')
-rw-r--r-- | gcc/combine.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/combine.c b/gcc/combine.c index ae25ef3..ce6cfde 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -11230,7 +11230,8 @@ change_zero_ext (rtx pat) else if (GET_CODE (x) == ZERO_EXTEND && SCALAR_INT_MODE_P (mode) && REG_P (XEXP (x, 0)) - && HARD_REGISTER_P (XEXP (x, 0))) + && HARD_REGISTER_P (XEXP (x, 0)) + && can_change_dest_mode (XEXP (x, 0), 0, mode)) { size = GET_MODE_PRECISION (GET_MODE (XEXP (x, 0))); x = gen_rtx_REG (mode, REGNO (XEXP (x, 0))); |