]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix RTL frontend handling of const_vectors
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 4 Nov 2021 08:28:44 +0000 (08:28 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 4 Nov 2021 08:28:44 +0000 (08:28 +0000)
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.

gcc/read-rtl-function.c
gcc/read-rtl.c

index 941d1e158a303b1f554116269499a1e73db426e4..5699f574a376139891f7b429ed67d558b1593e0b 100644 (file)
@@ -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;
     }
index 041166658d1748375b7477f45f6f80f8e5834235..b33dee0684257b154b96555634ef14e0c27c0ee1 100644 (file)
@@ -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;