From: Jeff Law <jeffreyalaw@gmail.com>
To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com
Subject: Re: [PATCH] recog: Disallow subregs in mode-punned value [PR115881]
Date: Tue, 30 Jul 2024 15:04:52 -0600 [thread overview]
Message-ID: <b744205d-b357-411d-bdc4-33fe0815c525@gmail.com> (raw)
In-Reply-To: <mptsew55llq.fsf@arm.com>
On 7/19/24 11:37 AM, Richard Sandiford wrote:
> In g:9d20529d94b23275885f380d155fe8671ab5353a, I'd extended
> insn_propagation to handle simple cases of hard-reg mode punning.
> The punned "to" value was created using simplify_subreg rather
> than simplify_gen_subreg, on the basis that hard-coded subregs
> aren't generally useful after RA (where hard-reg propagation is
> expected to happen).
>
> This PR is about a case where the subreg gets pushed into the
> operands of a plus, but the subreg on one of the operands
> cannot be simplified. Specifically, we have to generate
> (subreg:SI (reg:DI sp) 0) rather than (reg:SI sp), since all
> references to the stack pointer must be via stack_pointer_rtx.
>
> However, code in x86 (reasonably) expects no subregs of registers
> to appear after RA, except for special cases like strict_low_part.
> This leads to an awkward situation where we can't ban subregs of sp
> (because of the strict_low_part use), can't allow direct references
> to sp in other modes (because of the stack_pointer_rtx requirement),
> and can't allow rvalue uses of the subreg (because of the "no subregs
> after RA" assumption). It all seems a bit of a mess...
>
> I sat on this for a while in the hope that a clean solution might
> become apparent, but in the end, I think we'll just have to check
> manually for nested subregs and punt on them.
>
> Tested on aarch64-linux-gnu & x86_64-linux-gnu. OK to install?
>
> Richard
>
>
> gcc/
> PR rtl-optimization/115881
> * recog.cc: Include rtl-iter.h.
> (insn_propagation::apply_to_rvalue_1): Check that the result
> of simplify_subreg does not include nested subregs.
>
> gcc/tetsuite/
> PR rtl-optimization/115881
> * cc.c-torture/compile/pr115881.c: New test.
OK
jeff
prev parent reply other threads:[~2024-07-30 21:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-19 17:37 Richard Sandiford
2024-07-29 10:38 ` Ping: " Richard Sandiford
2024-07-30 21:04 ` Jeff Law [this message]
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=b744205d-b357-411d-bdc4-33fe0815c525@gmail.com \
--to=jeffreyalaw@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.sandiford@arm.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).