From patchwork Thu Nov 4 08:30:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1550798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=TLePiND9; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HlH1M5qhnz9sRN for ; Thu, 4 Nov 2021 19:31:50 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 395A53857C4E for ; Thu, 4 Nov 2021 08:31:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 395A53857C4E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636014707; bh=sBv0UIGl+QKqrvVOLg5f52ayYucxcVmkK6z/DRNRg+o=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=TLePiND9dhkAaceLFQ3DuHEHHIdNge3pMdk+E+ieSV8tuRTt8uVMbho+lA967b+z/ At+UD7Dcyjv7O9AVZ5EopF5yFVWtTG54Aw6dHmmwmtfhVzVjvP8B5NL38/o7HA3h7W mHsbgOc/Y0fLQyMRpqSp7yyHSltU6cDparWD5w54= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 403D43857C4B for ; Thu, 4 Nov 2021 08:30:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 403D43857C4B Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D56A41FB for ; Thu, 4 Nov 2021 01:30:30 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7AF153F719 for ; Thu, 4 Nov 2021 01:30:30 -0700 (PDT) To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] Fix RTL frontend handling of const_vectors Date: Thu, 04 Nov 2021 08:30:29 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Richard Sandiford via Gcc-patches From: Richard Sandiford Reply-To: Richard Sandiford Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" 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. Tested on aarch64-linux-gnu and aarch64_be-elf. Applied as obvious. Richard 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 | 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;