From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from server28.superhosting.bg (server28.superhosting.bg [217.174.156.11]) by sourceware.org (Postfix) with ESMTPS id 7F5993858D35 for ; Mon, 20 Nov 2023 18:56:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F5993858D35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dinux.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dinux.eu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7F5993858D35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.174.156.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700506611; cv=none; b=DhdWyfWns03+WkPKZV51K7lrH983l5lTAXI+m3/zftkHxX8oXdA1qy+oApiyHVdAErOfqFBRaFn/GAIveRwgY33L83BU8x7jo1NzKSTfm2H+oWeORfMvYcCT5SbICDRuENwls8Bm31ElIHRzZjT9tL4NAInXKcxOQUPyVXrIBHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700506611; c=relaxed/simple; bh=cYpD89il7KBwn46ld3uwaC+4M26B4Z7GaflN1J27HG0=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=SZGVM6LMRSyR8kEe0mf9pP/UcnwTovWoU9ECYeRRx8D9qfq8SrNXFhHsxLgWUqSTV16GrK17A0sOQUKtWSk4GphKpENISMetvQn+Wc11RueToTAtfjx5MQfsKumNIo/YI2FbrjPK3nelapb2RlDrxaD8S8hdQCy8ZSDMdxRtqkk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dinux.eu; s=default; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=B9D039KEi5A54bSB2CK4caND4tn/+VBkj1Ri7U7dhW8=; b=XQ2eCMUjb2aVz0q/dG48yMZTxo CjgXJROxml0MtzflXN/PITEo8r5Puq6+jjMVI/lMcku4lCy2nETh3DGJyNQCSzja0WKIZgaxIPGH8 hU6Av4kLonXYTcZ1LrLtDTmzAS7iGPu8nQQ8xq0YKi+766vlaX86sm+LlNQHDoJM4GAX13PhWy4VE yW+PAA7XY65Nx+x7me0LFBOOfrHItplAVe2pEdUGCAdf14QQN6BwQIG1kp8z09YdDPUwyXnpi4LQR pEUisPJ/leARtHni1VRj7eV54smvBkKpo6jO4leNYnNmPh78EllU1avmtqjJ0OVt6BnAfwU7lBGCZ WWbeDc0g==; Received: from [95.42.20.142] (port=34444 helo=localhost) by server28.superhosting.bg with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1r59Rp-000Ap9-2v; Mon, 20 Nov 2023 20:56:44 +0200 Date: Mon, 20 Nov 2023 20:56:43 +0200 From: Dimitar Dimitrov To: Jeff Law Cc: "gcc-patches@gcc.gnu.org" , Jivan Hakobyan Subject: Re: [RFA] New pass for sign/zero extension elimination Message-ID: References: <6d5f8ba7-0c60-4789-87ae-68617ce6ac2c@ventanamicro.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6d5f8ba7-0c60-4789-87ae-68617ce6ac2c@ventanamicro.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server28.superhosting.bg X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dinux.eu X-Get-Message-Sender-Via: server28.superhosting.bg: authenticated_id: dimitar@dinux.eu X-Authenticated-Sender: server28.superhosting.bg: dimitar@dinux.eu X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,WEIRD_PORT autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sun, Nov 19, 2023 at 05:47:56PM -0700, Jeff Law wrote: ... > +/* Process uses in INSN. Set appropriate bits in LIVENOW for any chunks of > + pseudos that become live, potentially filtering using bits from LIVE_TMP. > + > + If MODIFIED is true, then optimize sign/zero extensions to SUBREGs when > + the extended bits are never read and mark pseudos which had extensions > + eliminated in CHANGED_PSEUDOS. */ > + > +static void > +ext_dce_process_uses (rtx insn, bitmap livenow, bitmap live_tmp, > + bool modify, bitmap changed_pseudos) > +{ > + /* A nonlocal goto implicitly uses the frame pointer. */ > + if (JUMP_P (insn) && find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX)) > + { > + bitmap_set_range (livenow, FRAME_POINTER_REGNUM * 4, 4); > + if (!HARD_FRAME_POINTER_IS_FRAME_POINTER) > + bitmap_set_range (livenow, HARD_FRAME_POINTER_REGNUM * 4, 4); > + } > + > + subrtx_var_iterator::array_type array_var; > + rtx pat = PATTERN (insn); > + FOR_EACH_SUBRTX_VAR (iter, array_var, pat, NONCONST) > + { > + /* An EXPR_LIST (from call fusage) ends in NULL_RTX. */ > + rtx x = *iter; > + if (x == NULL_RTX) > + continue; > + > + /* So the basic idea in this FOR_EACH_SUBRTX_VAR loop is to > + handle SETs explicitly, possibly propagating live information > + into the uses. > + > + We may continue the loop at various points which will cause > + iteration into the next level of RTL. Breaking from the loop > + is never safe as it can lead us to fail to process some of the > + RTL and thus not make objects live when necessary. */ > + enum rtx_code xcode = GET_CODE (x); > + if (xcode == SET) > + { > + const_rtx dst = SET_DEST (x); > + rtx src = SET_SRC (x); > + const_rtx y; > + unsigned HOST_WIDE_INT bit = 0; > + > + /* The code of the RHS of a SET. */ > + enum rtx_code code = GET_CODE (src); > + > + /* ?!? How much of this should mirror SET handling, potentially > + being shared? */ > + if (SUBREG_BYTE (dst).is_constant () && SUBREG_P (dst)) Shouldn't SUBREG_P be checked first like: if (SUBREG_P (dst) && SUBREG_BYTE (dst).is_constant ()) On pru-unknown-elf with RTL checking I get: conftest.c:16:1: internal compiler error: RTL check: expected code 'subreg', have 'reg' in ext_dce_process_uses, at ext-dce.cc:421 16 | } | ^ 0x158b39e rtl_check_failed_code1(rtx_def const*, rtx_code, char const*, int, char const*) /mnt/nvme/dinux/local-workspace/gcc/gcc/rtl.cc:770 0x223a486 ext_dce_process_uses /mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:421 0x223b5ba ext_dce_process_bb /mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:651 0x223bdd3 ext_dce /mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:802 0x223c0ac execute /mnt/nvme/dinux/local-workspace/gcc/gcc/ext-dce.cc:868 Regards, Dimitar