From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 46C553858C2C for ; Thu, 14 Oct 2021 08:49:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 46C553858C2C 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 ED93311D4; Thu, 14 Oct 2021 01:49:35 -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 76F233F66F; Thu, 14 Oct 2021 01:49:35 -0700 (PDT) From: Richard Sandiford To: Robin Dapp via Gcc-patches Mail-Followup-To: Robin Dapp via Gcc-patches , Robin Dapp , richard.sandiford@arm.com Subject: Re: [PATCH] combine: Check for paradoxical subreg References: <23c7868a-6736-5c73-fa9a-05e3e5ef53d6@linux.ibm.com> Date: Thu, 14 Oct 2021 09:49:34 +0100 In-Reply-To: <23c7868a-6736-5c73-fa9a-05e3e5ef53d6@linux.ibm.com> (Robin Dapp via Gcc-patches's message of "Wed, 23 Jun 2021 13:33:48 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain 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-List-Received-Date: Thu, 14 Oct 2021 08:49:37 -0000 Sorry for the slow review. Robin Dapp via Gcc-patches writes: > Hi, > > while evaluating another patch that introduces more lvalue paradoxical > subregs I ran into an ICE in combine at > > wide_int o = wi::insert (rtx_mode_t (outer, temp_mode), > rtx_mode_t (inner, dest_mode), > offset, width); > > because width (=GET_MODE_PRECISION (dest_mode)) > GET_MODE_PRECISION > (temp_mode). > > From the comments and the code it looks like we do not want to handle a > paradoxical subreg here so I quickly added a check for it which prevents > the ICE. The check could also be added to reg_subword_p () I guess. Yeah, I think adding it to reg_subword_p would be better, immediately after the GET_CODE (x) == SUBREG test. OK with that change, thanks. Richard > > Is this the right thing to do or am I missing something, i.e. my other > patch might be doing something it should not? > > Bootstrap on s390x was successful and testsuite is looking good so far. > > Regards > Robin > > -- > > gcc/ChangeLog: > > * combine.c (try_combine): Check for paradoxical subreg. > > From 2b74c66f8d97c30c45e99336c9871cccd8cf94e1 Mon Sep 17 00:00:00 2001 > From: Robin Dapp > Date: Tue, 22 Jun 2021 17:35:37 +0200 > Subject: [PATCH 11/11] combine paradoxical subreg fix. > > --- > gcc/combine.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/gcc/combine.c b/gcc/combine.c > index 6476812a212..de04560db21 100644 > --- a/gcc/combine.c > +++ b/gcc/combine.c > @@ -2782,7 +2782,8 @@ try_combine (rtx_insn *i3, rtx_insn *i2, rtx_insn *i1, rtx_insn *i0, > && CONST_SCALAR_INT_P (SET_SRC (temp_expr)) > && GET_CODE (PATTERN (i3)) == SET > && CONST_SCALAR_INT_P (SET_SRC (PATTERN (i3))) > - && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr))) > + && reg_subword_p (SET_DEST (PATTERN (i3)), SET_DEST (temp_expr)) > + && !paradoxical_subreg_p (SET_DEST (PATTERN (i3)))) > { > rtx dest = SET_DEST (PATTERN (i3)); > rtx temp_dest = SET_DEST (temp_expr);