From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48325 invoked by alias); 11 Oct 2019 09:02:33 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 48311 invoked by uid 89); 11 Oct 2019 09:02:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: gate.crashing.org Received: from gate.crashing.org (HELO gate.crashing.org) (63.228.1.57) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 11 Oct 2019 09:02:32 +0000 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id x9B92U7T003705; Fri, 11 Oct 2019 04:02:30 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id x9B92TUC003703; Fri, 11 Oct 2019 04:02:29 -0500 Date: Fri, 11 Oct 2019 09:02:00 -0000 From: Segher Boessenkool To: Jim Wilson Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH, v2] Extend subst to simplify CONST_INT inside SIGN_EXTEND. Message-ID: <20191011090229.GJ9749@gate.crashing.org> References: <20191009201114.22083-1-jimw@sifive.com> <20191010221636.22199-1-jimw@sifive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191010221636.22199-1-jimw@sifive.com> User-Agent: Mutt/1.4.2.3i X-IsSubscribed: yes X-SW-Source: 2019-10/txt/msg00795.txt.bz2 Hi! On Thu, Oct 10, 2019 at 03:16:36PM -0700, Jim Wilson wrote: > This addresses PR 91860 which has four testcases triggering internal errors. > The problem here is that in combine when handling debug insns, we are trying > to substitute > (sign_extend:DI (const_int 8160 [0x1fe0])) > as the value for > (reg:DI 78 [ _9 ]) > in the debug insn > (debug_insn 29 28 30 2 (var_location:QI d (subreg:QI (reg:DI 78 [ _9 ]) 0)) "tmp4.c":11:5 -1 > (nil)) > This eventually triggers an abort because 8160 is not a sign-extended > QImode value. > > We should avoid creating the invalid RTL in the first place. It is *normal* for combine to create invalid RTL. It first creates it, and it checks if it is valid later. However: > In subst there > is already code to avoid putting a CONST_INT inside a ZERO_EXTEND. This > needs to be extended to also handle a SIGN_EXTEND the same way. That works, sure. Approved for trunk. Thanks! Segher