public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/aoliva/heads/testme)] Disallow SUBREG of MEM
Date: Fri,  6 May 2022 02:31:32 +0000 (GMT)	[thread overview]
Message-ID: <20220506023132.5A0823856DC4@sourceware.org> (raw)

https://gcc.gnu.org/g:4c180902db3bc44b13b251e454c850f485b0fa5a

commit 4c180902db3bc44b13b251e454c850f485b0fa5a
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu May 5 23:25:39 2022 -0300

    Disallow SUBREG of MEM
    
    Introduce TARGET_ALLOW_SUBREG_OF_MEM, defaulting to 0.
    
    Reject SUBREG of MEM regardless of alignment, unless the macro is
    defined to nonzero.
    
    
    for  gcc/ChangeLog
    
            PR target/100106
            * emit-rtl.cc (validate_subreg) [!TARGET_ALLOW_SUBREG_OF_MEM]:
            Reject SUBREG of MEM.

Diff:
---
 gcc/emit-rtl.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/emit-rtl.cc b/gcc/emit-rtl.cc
index 9c03e27894f..f055179b3b8 100644
--- a/gcc/emit-rtl.cc
+++ b/gcc/emit-rtl.cc
@@ -983,8 +983,12 @@ validate_subreg (machine_mode omode, machine_mode imode,
       return subreg_offset_representable_p (regno, imode, offset, omode);
     }
   /* Do not allow SUBREG with stricter alignment than the inner MEM.  */
-  else if (reg && MEM_P (reg) && STRICT_ALIGNMENT
-	   && MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (omode))
+  else if (reg && MEM_P (reg)
+#if TARGET_ALLOW_SUBREG_OF_MEM /* ??? Reject them all eventually.  */
+	   && STRICT_ALIGNMENT
+	   && MEM_ALIGN (reg) < GET_MODE_ALIGNMENT (omode)
+#endif
+	   )
     return false;
 
   /* The outer size must be ordered wrt the register size, otherwise


                 reply	other threads:[~2022-05-06  2:31 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=20220506023132.5A0823856DC4@sourceware.org \
    --to=aoliva@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: 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).