From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by sourceware.org (Postfix) with ESMTPS id 154DC3858C2B for ; Wed, 22 Nov 2023 22:24:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 154DC3858C2B Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 154DC3858C2B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::c2e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700691856; cv=none; b=BIfHNELaBiWcdDHmziLxOKXczBCKWtYFq96SSZ/ptYyT1Zyfp4WOZtPRKXuY4VMdaGSXlYGyxang0ocerBj1a4vnayC8sDpKVYAK5uSJoqA/KDoHRgMPptsG5q5ZZdQP51iFDr9ZXZfmyEs8sJJrQsBqUhSBAfrJ/8q044UemL4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700691856; c=relaxed/simple; bh=E3didEngkie+JJdrIWVRX6kj/1Bh3mZHIyVYQFfTb8M=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=oqN6551Qfezrsp4mzT/Y1QbEWIiLG741p4Nr4EdQPYjkutSF77dMNyIspOjYFTLCB+V8K7f5mLFt5jZ4X9ORRxXIw9wOVm1hWPiT5MAzHfbwkD3yuEEzNqSWJLdeVOybIHhI2kPAcMLlW4DzmtoBqYVSWaj8kqW4IEXLGrADfLc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oo1-xc2e.google.com with SMTP id 006d021491bc7-586ad15f9aaso145567eaf.2 for ; Wed, 22 Nov 2023 14:24:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700691845; x=1701296645; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=jcrFBOVq2TXD7ydJNT64bNLpmzefgRScNt08R7CkgzM=; b=FosbeW05SkxKQ2k5aLUTGZCbBbShGdCIsHOnupP0nR2zgohbDVXFukzE8nzv2TlKsD 63FmU6fB/9X/n6ZcNQ8evuTJ8ISnfrt26RqnhI+SYPQNA6VqerPdZkkmKbZzNZJdgyiv AQlkRghzxdcGde5CYKmavXduI7cNI3CcL09ZRh55vEK1Rq0NtBQHSh9Ps02zmr2iPtTu 2kUYRDVPdEr3iFUeEASC+9ecIuRepBB7mYdcvV/pURyGaszl/UBMD5FduBr7qzjx3zjb BDCO7K1SHXjji27/UOVsQpmdywuBq9fPphO6TGjzv1xijiRR2iDYC4+OaVi5dtp7FXVt OHMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700691845; x=1701296645; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jcrFBOVq2TXD7ydJNT64bNLpmzefgRScNt08R7CkgzM=; b=PJFPKhB5fk+fzuYaC2tR2Ri7gvMl9v7hOYQsMk/k3IakLsRG0qMAzOg0FRr9XYSUHA ZmUUW8323xuF+5ZFLgdB1WHIleCoqUFXxGMUo9XFQ6EDJQmwFtDpxKAcKiYqYyvfOuBD s5eR5K7PYwiuQxluF7ivwe1m5KOV7sV3fjzeIIr1WxYcsQZM35Ts9MuuUq/LU0yO0m55 5dgAY1GccZuTOvBz4AO1duZ6eCac1sxKGrRwDn9i3YSb6XCA0/J8n85Wsv8fvY0+Qlh+ zOJhgAfgbLsCXF5xfmefDjxi3XbXEcTb/1kDa0mMeUeijVabW7Y8IgWJ9f/OYJX4ThiP RfaQ== X-Gm-Message-State: AOJu0Yz8hmlWio6R5zSlT1QBFoUJCS1nqeNIIlDOX+2AK1ktNkCHOLX/ 73u2iYxYU7EJQq46P6O78vs= X-Google-Smtp-Source: AGHT+IHnptsrzh532u8/Eq7Ns/wynRmsXccSnhCQHxBu1O+PYmNiYVLDmpa9cFzQG46+g/wf+Wmnwg== X-Received: by 2002:a05:6820:1607:b0:58a:1595:c645 with SMTP id bb7-20020a056820160700b0058a1595c645mr4343660oob.4.1700691845178; Wed, 22 Nov 2023 14:24:05 -0800 (PST) Received: from [172.31.0.109] ([136.36.130.248]) by smtp.gmail.com with ESMTPSA id a7-20020a4ab787000000b0054f85f67f31sm77273oop.46.2023.11.22.14.23.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Nov 2023 14:23:52 -0800 (PST) Message-ID: Date: Wed, 22 Nov 2023 15:23:41 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFA] New pass for sign/zero extension elimination Content-Language: en-US To: Dimitar Dimitrov , Jeff Law Cc: "gcc-patches@gcc.gnu.org" , Jivan Hakobyan References: <6d5f8ba7-0c60-4789-87ae-68617ce6ac2c@ventanamicro.com> From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 11/20/23 11:56, Dimitar Dimitrov wrote: > 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 ()) Yes, absolutely. It'll be fixed in the next update. This also highlighted that I never added pru-elf to the configurations in my tester. I remember thinking that it needed to be added, but obviously that mental TODO got lost. I've just fixed that. jeff