public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Peter Bergner <bergner@linux.ibm.com>
Cc: Vladimir N Makarov <vmakarov@redhat.com>,
	Segher Boessenkool <segher@kernel.crashing.org>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [RFC][PATCH LRA] WIP patch to fix one part of PR87507
Date: Tue, 06 Nov 2018 20:28:00 -0000	[thread overview]
Message-ID: <2c42a37e-3f96-02e4-1c72-4c3712872f1a@redhat.com> (raw)
In-Reply-To: <8e712264-7ffd-5715-9d4a-35be74344e5a@linux.ibm.com>

On 10/27/18 10:24 AM, Peter Bergner wrote:
> On 10/22/18 6:45 PM, Peter Bergner wrote:
>> Bah, my bootstrap failed and I need to make a small change.  Let me do that
>> and verify my bootstraps get all the way thru before I give you the updated
>> patch.  Sorry.
> Ok, the following updated patch survives bootstrap and regtesting on
> powerpc64le-linux, x86_64-linux and s390x-linux with no regressions.
> Changes from the previous patch is that checking for illegal hard register
> usage in inline asm statements has been moved to expand time.  Secondly, the
> lra constraints code now checks for both HARD_REGISTER_P and REG_USERVAR_P.
> This was because I was seeing combine forcing hard regs into a pattern
> (not from inline asm) which lra needed to spill to match constraints,
> which it should be able to do.
> 
> Jeff, can you give this a try on your testers to see how it behaves on
> the other arches that were having problems?
> 
> Peter
> 
> 	PR rtl-optimization/87600
> 	* cfgexpand.c (expand_asm_stmt): Catch illegal asm constraint usage.
> 	* lra-constraints.c (process_alt_operands): Skip illegal hard
> 	register usage.  Prefer reloading non hard register operands.



> 

> Index: gcc/lra-constraints.c
> ===================================================================
> --- gcc/lra-constraints.c	(revision 265402)
> +++ gcc/lra-constraints.c	(working copy)
> @@ -2146,9 +2146,30 @@ process_alt_operands (int only_alternati
>  		      }
>  		    else
>  		      {
> -			/* Operands don't match.  Both operands must
> -			   allow a reload register, otherwise we
> -			   cannot make them match.  */
> +			/* Operands don't match.  If the operands are
> +			   different user defined explicit hard registers,
> +			   then we cannot make them match.  */
> +			if ((REG_P (*curr_id->operand_loc[nop])
> +			     || SUBREG_P (*curr_id->operand_loc[nop]))
> +			    && (REG_P (*curr_id->operand_loc[m])
> +				|| SUBREG_P (*curr_id->operand_loc[m])))
> +			  {
> +			    rtx nop_reg = *curr_id->operand_loc[nop];
> +			    if (SUBREG_P (nop_reg))
> +			      nop_reg = SUBREG_REG (nop_reg);
> +			    rtx m_reg = *curr_id->operand_loc[m];
> +			    if (SUBREG_P (m_reg))
> +			      m_reg = SUBREG_REG (m_reg);
So the one worry I have/had in this code is nested subregs.  My
recollection is they do happen in rare cases.  But I can also find a
reference  where Jim W. has indicated they're invalid (and I absolutely
trust Jim on this kind of historical RTL stuff).

https://gcc.gnu.org/ml/gcc/2005-04/msg01173.html

Reviewing cases where we've written the stripping as a loop, several are
stripping subregs as well as extractions.  And I can certainly believe
that we could have an RTX with some combination of subregs and
extractions.  The exception to that pattern would be reload which has
subreg stripping loops that only strip the subregs.

So, after all that, I think we're OK.  It might make sense to verify we
don't have nested subregs in the IL verifiers.  Bonus points if you add
that checking.

So ideally we'd have some tests which tickle this code, even if they're
target specific.

So I'm OK with this patch and also OK with adding tests independently as
a follow-up.

jeff

  reply	other threads:[~2018-11-06 20:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-19 21:51 Peter Bergner
2018-10-20  6:47 ` Peter Bergner
2018-10-20 21:05   ` Segher Boessenkool
2018-10-22 22:08   ` Jeff Law
2018-10-23  0:25     ` Peter Bergner
2018-10-23  1:16       ` Peter Bergner
2018-10-27 23:25         ` Peter Bergner
2018-11-06 20:28           ` Jeff Law [this message]
2018-11-07  0:14             ` Segher Boessenkool
2018-11-07 16:29               ` Peter Bergner
2018-11-07 17:36                 ` Jeff Law
2018-11-07 17:45                   ` Peter Bergner
2018-11-08  2:17                   ` Peter Bergner
2018-11-08 22:07                     ` Jeff Law
2018-11-08 22:42                       ` Peter Bergner
2018-10-23  4:54       ` Segher Boessenkool
2018-10-23  6:47         ` Peter Bergner
2018-10-25  0:55         ` Jeff Law
2018-10-20 17:23 ` Segher Boessenkool
2018-10-22 23:23 ` Vladimir Makarov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c42a37e-3f96-02e4-1c72-4c3712872f1a@redhat.com \
    --to=law@redhat.com \
    --cc=bergner@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=segher@kernel.crashing.org \
    --cc=vmakarov@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).