public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-4883] Fix RTL frontend handling of const_vectors
Date: Thu,  4 Nov 2021 08:29:10 +0000 (GMT)	[thread overview]
Message-ID: <20211104082910.380A53858C3A@sourceware.org> (raw)

https://gcc.gnu.org/g:95318d469f4d293446b4fd38d527fd5d64ce0b70

commit r12-4883-g95318d469f4d293446b4fd38d527fd5d64ce0b70
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Thu Nov 4 08:28:44 2021 +0000

    Fix RTL frontend handling of const_vectors
    
    The RTL frontend makes sure that CONST_INTs use shared rtxes where
    appropriate.  We should do the same thing for CONST_VECTORs,
    reusing CONST0_RTX, CONST1_RTX and CONSTM1_RTX.  This also has
    the effect of setting CONST_VECTOR_NELTS_PER_PATTERN and
    CONST_VECTOR_NPATTERNS.
    
    While looking at where to add that, I noticed we had some dead #includes
    in read-rtl.c.  Some of the stuff that read-rtl-function.c does was once
    in that file instead.
    
    gcc/
            * read-rtl.c: Remove dead !GENERATOR_FILE block.
            * read-rtl-function.c (function_reader::consolidate_singletons):
            Generate canonical CONST_VECTORs.

Diff:
---
 gcc/read-rtl-function.c | 3 +++
 gcc/read-rtl.c          | 6 ------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/gcc/read-rtl-function.c b/gcc/read-rtl-function.c
index 941d1e158a3..5699f574a37 100644
--- a/gcc/read-rtl-function.c
+++ b/gcc/read-rtl-function.c
@@ -1498,6 +1498,9 @@ function_reader::consolidate_singletons (rtx x)
     case CONST_INT:
       return gen_rtx_CONST_INT (GET_MODE (x), INTVAL (x));
 
+    case CONST_VECTOR:
+      return gen_rtx_CONST_VECTOR (GET_MODE (x), XVEC (x, 0));
+
     default:
       break;
     }
diff --git a/gcc/read-rtl.c b/gcc/read-rtl.c
index 041166658d1..b33dee06842 100644
--- a/gcc/read-rtl.c
+++ b/gcc/read-rtl.c
@@ -36,12 +36,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "read-md.h"
 #include "gensupport.h"
 
-#ifndef GENERATOR_FILE
-#include "function.h"
-#include "memmodel.h"
-#include "emit-rtl.h"
-#endif
-
 /* One element in a singly-linked list of (integer, string) pairs.  */
 struct map_value {
   struct map_value *next;


                 reply	other threads:[~2021-11-04  8:29 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=20211104082910.380A53858C3A@sourceware.org \
    --to=rsandifo@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).