From patchwork Sun Jul 21 13:37:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 94294 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 054B1385E457 for ; Sun, 21 Jul 2024 13:38:37 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-oi1-x22f.google.com (mail-oi1-x22f.google.com [IPv6:2607:f8b0:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id F1C7E385B50B for ; Sun, 21 Jul 2024 13:37:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F1C7E385B50B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=ventanamicro.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=ventanamicro.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F1C7E385B50B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::22f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721569072; cv=none; b=qGIYrfL4z7vmGXrYKlbhBNDwlUIwGtuR+s43XokPe5pHN3LkICIv5/VgMNH/LdEdBpjr/1BkkptuxxqpjXJ0C2eLqcrbCNzrp9GwpO+XE+6ESMZANxy3YTuQUpB8YAREHeB7L1zg247Tu3XXWO4LCvh8HQD+bAU8ozrJog86O70= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721569072; c=relaxed/simple; bh=GUQPBn8jT07eUuBpx3qwyw6XnFI6+xIZKZEjsF6RA4c=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:Subject:To; b=BQVJeytzuSSGAsbA5/u2ucPlQUwPdMLFJqP/o64bfQ6IJcF0qyOTtQsFRmb3oEcOqETn1tDZ4AHkuHFuwL5G1hFCzvSu7EjEiIVfOF0+sMe8l7cNKn3UIGjGZ1cOaNVTRdAMY5NstBTCgdsffg2O2Tx1xSZxSnov0Af1S0k7NJo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x22f.google.com with SMTP id 5614622812f47-3d9e13ef8edso2181771b6e.2 for ; Sun, 21 Jul 2024 06:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1721569068; x=1722173868; darn=gcc.gnu.org; h=to:subject:from:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=m4uMLtKevIojqmVAS57WCOT6LTsBXEUWrTHL19yv2kM=; b=EsxP7tetHdBW/F2TZxMYydtwntEOXBwpS7Ibx59X7tuitUH7rXN6hMLd6psUS1ZAl+ +hWn70Le6A4V3lPlXHkYD+4BaImUrFUdG68KrJe5I+N/FJjIIlqEIa/RqqdZr9ScmFtL u1ZK7WC+4VWQ8a+P+ij2Wz9DyFjZBU7HlM0jDsVZYlkMNoXbRb65TRimPSMzHsA6Qpcd 0nmbW6BiTVUwGAEG1kDovH/wLP5hqiPjKjUV2xcvSXmtHcovj8ecuV2hrH39tpppPYBM JWNt5LZLT7uOtFLLgaMS+K1g+cDwGZiEQOxX/Ve8Uja4cHETkHf01vwgiV0ZJgkRHSiS 4+RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721569068; x=1722173868; h=to:subject:from:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=m4uMLtKevIojqmVAS57WCOT6LTsBXEUWrTHL19yv2kM=; b=DFjPyJ6ixW8uj6jzB0WXZUwuXVSG18pyjf68BcD7dL70oMHYDkTgrshrYUswtApQcD 1yyuQW3YgSlylkUHwWCi4tKAQf9SVX4Cxvg97D3TPccFiORVR+oTEUolfq3y8J+a40NN xRokUq+rELBiN4MWF8RZlnygsaraF6pHJBQhMzyKcfL1Mgz9tdFQRaSQ5/UKbYS/gWx2 6LOiZTJX05oMEhqn4PAe7iuKw3oyaukpy2iFjt5PFeUv4PtIK4aURrIspX5sLmGX6axr UEkSrDmFleLrnJ0nell4/36x76MvqR64k87ip/WrM/D6XKx6cqWc+328iCr5hdNVLKgU kuDw== X-Gm-Message-State: AOJu0YyrvKpzWQABYU/K5NqBmDnxs0wFrax9Mpspk4St4SNLi9bUezQR 5GzbxWIYi8nv0B1JRHIRInX7nJYOnKtbwXdEJkAqVvnPc7Iq193hGne0cNWsLkAAYuoOuiakiPw oGs0= X-Google-Smtp-Source: AGHT+IGLFF8QxOuQlPYlrg8Gae2nBPyUxBb4+qZrGdNMUnSEvKrJHhz6snSKYwa3TbFOwHpQFrEayA== X-Received: by 2002:a05:6808:1a17:b0:3da:a8b6:c96 with SMTP id 5614622812f47-3dae6374282mr7654641b6e.41.1721569068395; Sun, 21 Jul 2024 06:37:48 -0700 (PDT) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3dae09cef3dsm1094541b6e.44.2024.07.21.06.37.47 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jul 2024 06:37:48 -0700 (PDT) Message-ID: <2201f3e6-ad3c-4baa-b683-8abe84ddb668@ventanamicro.com> Date: Sun, 21 Jul 2024 07:37:46 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Content-Language: en-US From: Jeff Law Subject: [committed] [PR rtl-optimization/115877] Fix livein computation for ext-dce To: "gcc-patches@gcc.gnu.org" X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org So I'm not yet sure how I'm going to break everything down, but this is easy enough to break out as 1/N of ext-dce fixes/improvements. When handling uses in an insn, we first determine what bits are set in the destination which is represented in DST_MASK. Then we use that to refine what bits are live in the source operands. In the source operand handling section we *modify* DST_MASK if the source operand is a SUBREG (ugh!). So if the first operand is a SUBREG, then we can incorrectly compute which bit groups are live in the second operand, especially if it is a SUBREG as well. This was seen when testing a larger set of patches on the rl78 port (builtin-arith-overflow-p-7 & pr71631 execution failures), so no new test for this bugfix. Run through my tester (in conjunction with other ext-dce changes) on the various cross targets. Run individually through a bootstrap and regression test cycle on x86_64 as well. Pushing to the trunk. jeff PR rtl-optimization/115877 gcc/ * ext-dce.cc (ext_dce_process_uses): Restore the value of DST_MASK for reach operand. diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc index 6d4b8858ec6..c4c38659701 100644 --- a/gcc/ext-dce.cc +++ b/gcc/ext-dce.cc @@ -591,8 +678,10 @@ ext_dce_process_uses (rtx_insn *insn, rtx obj, bitmap live_tmp) making things live. Breaking from this loop will cause the iterator to work on sub-rtxs, so it is safe to break if we see something we don't know how to handle. */ + unsigned HOST_WIDE_INT save_mask = dst_mask; for (;;) { + dst_mask = save_mask; /* Strip an outer paradoxical subreg. The bits outside the inner mode are don't cares. So we can just strip and process the inner object. */