public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Matthew Malcomson <matmal01@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/morello)] Avoid trans-capability MEM_REF relaxation in SLSR Date: Thu, 5 May 2022 12:04:29 +0000 (GMT) [thread overview] Message-ID: <20220505120429.85F8A3856270@sourceware.org> (raw) https://gcc.gnu.org/g:730d6010d4773bba7255a5cd845c9d48826c4074 commit 730d6010d4773bba7255a5cd845c9d48826c4074 Author: Matthew Malcomson <matthew.malcomson@arm.com> Date: Thu Mar 17 15:49:47 2022 +0000 Avoid trans-capability MEM_REF relaxation in SLSR There is an optimisation in SLSR that takes a COMPONENT_REF (or similar) whose base is a MEM_REF, and it splits that out into a MEM_REF using a different offset (pre-calculated using known constants). When performing this optimisation it uses the type of the offset for different things, and ends up changing the type of the MEM_REF base to the type of the offset. This is problematic, since if the base is a capability type and the offset is not this is throwing away the capability features. Here we just disable this optimisation if the two types are not compatible. Diff: --- gcc/gimple-ssa-strength-reduction.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index 3b7e1994abb..45f58df40df 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -993,6 +993,14 @@ restructure_reference (tree *pbase, tree *poffset, widest_int *pindex, t1 = TREE_OPERAND (base, 0); c1 = widest_int::from (mem_offset, SIGNED); type = TREE_TYPE (TREE_OPERAND (base, 1)); + /* MORELLO TODO HYBRID + * When splitting these MEM_REF's out we currently use the type of the + * offset rather than the type of the base pointer. If the base pointer and + * offset types differ in their capability nature then these types are not + * interchangeable. There is probably a way around this, but it's a simple + * and safe solution to avoid the optimisation in that case. */ + if (!types_compatible_p (type, TREE_TYPE (t1))) + return false; mult_op0 = TREE_OPERAND (offset, 0); c3 = wi::to_widest (TREE_OPERAND (offset, 1));
reply other threads:[~2022-05-05 12:04 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220505120429.85F8A3856270@sourceware.org \ --to=matmal01@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /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: linkBe 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).