Commit a9b76c89 by Richard Sandiford Committed by Richard Sandiford

Prevent invalid register mode changes in combine

This patch stops combine from changing the mode of an existing register
in-place if doing so would change the size of the underlying register
allocation size, as given by REGMODE_NATURAL_SIZE.  Without this,
many tests fail in adjust_reg_mode after SVE is added.  One example
is gcc.c-torture/compile/20090401-1.c.

2017-11-01  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/
	* combine.c (can_change_dest_mode): Reject changes in
	REGMODE_NATURAL_SIZE.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>

From-SVN: r254291
parent 6e0cb45f
2017-11-01 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
* combine.c (can_change_dest_mode): Reject changes in
REGMODE_NATURAL_SIZE.
2017-10-31 Sandra Loosemore <sandra@codesourcery.com> 2017-10-31 Sandra Loosemore <sandra@codesourcery.com>
* configure.ac (--enable-libssp): New. * configure.ac (--enable-libssp): New.
...@@ -2478,6 +2478,12 @@ can_change_dest_mode (rtx x, int added_sets, machine_mode mode) ...@@ -2478,6 +2478,12 @@ can_change_dest_mode (rtx x, int added_sets, machine_mode mode)
!= REGMODE_NATURAL_SIZE (GET_MODE (x))) != REGMODE_NATURAL_SIZE (GET_MODE (x)))
return false; return false;
/* Don't change between modes with different underlying register sizes,
since this could lead to invalid subregs. */
if (REGMODE_NATURAL_SIZE (mode)
!= REGMODE_NATURAL_SIZE (GET_MODE (x)))
return false;
regno = REGNO (x); regno = REGNO (x);
/* Allow hard registers if the new mode is legal, and occupies no more /* Allow hard registers if the new mode is legal, and occupies no more
registers than the old mode. */ registers than the old mode. */
......
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