From: rsandifo Date: Wed, 3 Jan 2018 07:18:38 +0000 (+0000) Subject: poly_int: process_alt_operands X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e23bf764a69d8945d55c5e41cc7be2006f539e43;p=thirdparty%2Fgcc.git poly_int: process_alt_operands This patch makes process_alt_operands check that the mode sizes are ordered, so that match_reload can validly treat them as subregs of one another. 2018-01-03 Richard Sandiford Alan Hayward David Sherwood gcc/ * lra-constraints.c (process_alt_operands): Reject matched operands whose sizes aren't ordered. (match_reload): Refer to this check here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256158 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2eea29ba5e0a..799be1c22efc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-01-03 Richard Sandiford + Alan Hayward + David Sherwood + + * lra-constraints.c (process_alt_operands): Reject matched + operands whose sizes aren't ordered. + (match_reload): Refer to this check here. + 2018-01-03 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/lra-constraints.c b/gcc/lra-constraints.c index 73ffba2c75fc..59daf11062a8 100644 --- a/gcc/lra-constraints.c +++ b/gcc/lra-constraints.c @@ -933,6 +933,8 @@ match_reload (signed char out, signed char *ins, signed char *outs, push_to_sequence (*before); if (inmode != outmode) { + /* process_alt_operands has already checked that the mode sizes + are ordered. */ if (partial_subreg_p (outmode, inmode)) { reg = new_in_reg @@ -2112,6 +2114,13 @@ process_alt_operands (int only_alternative) len = 0; lra_assert (nop > m); + /* Reject matches if we don't know which operand is + bigger. This situation would arguably be a bug in + an .md pattern, but could also occur in a user asm. */ + if (!ordered_p (GET_MODE_SIZE (biggest_mode[m]), + GET_MODE_SIZE (biggest_mode[nop]))) + break; + this_alternative_matches = m; m_hregno = get_hard_regno (*curr_id->operand_loc[m], false); /* We are supposed to match a previous operand.