public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dimitar Dimitrov <dimitar@dinux.eu>
To: Jeff Law <jlaw@ventanamicro.com>
Cc: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	Jivan Hakobyan <jivanhakobyan9@gmail.com>
Subject: Re: [RFA] New pass for sign/zero extension elimination
Date: Mon, 20 Nov 2023 20:56:43 +0200	[thread overview]
Message-ID: <ZVur6xh5W1lNU4mD@kendros> (raw)
In-Reply-To: <6d5f8ba7-0c60-4789-87ae-68617ce6ac2c@ventanamicro.com>

On Sun, Nov 19, 2023 at 05:47:56PM -0700, Jeff Law wrote:
...
> +/* Process uses in INSN.  Set appropriate bits in LIVENOW for any chunks of
> +   pseudos that become live, potentially filtering using bits from LIVE_TMP.
> +
> +   If MODIFIED is true, then optimize sign/zero extensions to SUBREGs when
> +   the extended bits are never read and mark pseudos which had extensions
> +   eliminated in CHANGED_PSEUDOS.  */
> +
> +static void
> +ext_dce_process_uses (rtx insn, bitmap livenow, bitmap live_tmp,
> +		      bool modify, bitmap changed_pseudos)
> +{
> +  /* A nonlocal goto implicitly uses the frame pointer.  */
> +  if (JUMP_P (insn) && find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX))
> +    {
> +      bitmap_set_range (livenow, FRAME_POINTER_REGNUM * 4, 4);
> +      if (!HARD_FRAME_POINTER_IS_FRAME_POINTER)
> +	bitmap_set_range (livenow, HARD_FRAME_POINTER_REGNUM * 4, 4);
> +    }
> +
> +  subrtx_var_iterator::array_type array_var;
> +  rtx pat = PATTERN (insn);
> +  FOR_EACH_SUBRTX_VAR (iter, array_var, pat, NONCONST)
> +    {
> +      /* An EXPR_LIST (from call fusage) ends in NULL_RTX.  */
> +      rtx x = *iter;
> +      if (x == NULL_RTX)
> +	continue;
> +
> +      /* So the basic idea in this FOR_EACH_SUBRTX_VAR loop is to
> +	 handle SETs explicitly, possibly propagating live information
> +	 into the uses.
> +
> +	 We may continue the loop at various points which will cause
> +	 iteration into the next level of RTL.  Breaking from the loop
> +	 is never safe as it can lead us to fail to process some of the
> +	 RTL and thus not make objects live when necessary.  */
> +      enum rtx_code xcode = GET_CODE (x);
> +      if (xcode == SET)
> +	{
> +	  const_rtx dst = SET_DEST (x);
> +	  rtx src = SET_SRC (x);
> +	  const_rtx y;
> +	  unsigned HOST_WIDE_INT bit = 0;
> +
> +	  /* The code of the RHS of a SET.  */
> +	  enum rtx_code code = GET_CODE (src);
> +
> +	  /* ?!? How much of this should mirror SET handling, potentially
> +	     being shared?   */
> +	  if (SUBREG_BYTE (dst).is_constant () && SUBREG_P (dst))

Shouldn't SUBREG_P be checked first like:
	  if (SUBREG_P (dst) && SUBREG_BYTE (dst).is_constant ())

On pru-unknown-elf with RTL checking I get:

conftest.c:16:1: internal compiler error: RTL check: expected code 'subreg', have 'reg' in ext_dce_process_uses, at ext-dce.cc:421
   16 | }
      | ^
0x158b39e rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int, char const*)
        /mnt/nvme/dinux/local-workspace/gcc/gcc/rtl.cc:770
0x223a486 ext_dce_process_uses
        /mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:421
0x223b5ba ext_dce_process_bb
        /mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:651
0x223bdd3 ext_dce
        /mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:802
0x223c0ac execute
        /mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:868


Regards,
Dimitar

  parent reply	other threads:[~2023-11-20 18:56 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20  0:47 Jeff Law
2023-11-20  1:22 ` Oleg Endo
2023-11-20  2:51   ` Jeff Law
2023-11-20  2:57     ` Oleg Endo
2023-11-20  2:23 ` Xi Ruoyao
2023-11-20  2:46   ` Jeff Law
2023-11-20  2:52   ` Jeff Law
2023-11-20  3:32     ` Xi Ruoyao
2023-11-20  3:48       ` Jeff Law
2023-11-20 18:26 ` Richard Sandiford
2023-11-22 17:59   ` Jeff Law
2023-11-27 20:15     ` Richard Sandiford
2023-11-20 18:56 ` Dimitar Dimitrov [this message]
2023-11-22 22:23   ` Jeff Law
2023-11-26 16:42     ` rep.dot.nop
2023-11-27 16:14       ` Jeff Law
2023-11-27 11:30 ` Andrew Stubbs
2023-11-27 16:16   ` Jeff Law
2023-12-01  1:08 ` Hans-Peter Nilsson
2023-12-01 15:09   ` Jeff Law
2023-12-01 16:17     ` Hans-Peter Nilsson
2023-11-27 17:36 Joern Rennecke
2023-11-27 17:57 ` Joern Rennecke
2023-11-27 20:03   ` Richard Sandiford
2023-11-27 20:18     ` Jeff Law
2023-11-28 13:36       ` Joern Rennecke
2023-11-28 14:09         ` Joern Rennecke
2023-11-30 17:33         ` Jeff Law
2023-11-28 13:13     ` Joern Rennecke
2023-11-28  5:50 ` Jeff Law
2023-11-27 18:19 Joern Rennecke
2023-11-28  5:51 ` Jeff Law
2023-11-29 17:37 Joern Rennecke
2023-11-29 19:13 ` Jivan Hakobyan
2023-11-30 15:37 ` Jeff Law

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=ZVur6xh5W1lNU4mD@kendros \
    --to=dimitar@dinux.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jivanhakobyan9@gmail.com \
    --cc=jlaw@ventanamicro.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).