From patchwork Mon Sep 2 04:19:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 1979507 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=DE5P7nRb; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WxwWz0zm6z1yXY for ; Mon, 2 Sep 2024 14:19:57 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9C523385E830 for ; Mon, 2 Sep 2024 04:19:55 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 372F73858C48 for ; Mon, 2 Sep 2024 04:19:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 372F73858C48 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 372F73858C48 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::336 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725250775; cv=none; b=M6QxBy0Ww8+wbxfUrE5SCtd1wl/PcO3cjrK3QhZk4rANSBhe8rmu6gML5z+vEFu+aIdQjW5W9WtGRHfQ4n26xD86dt4nFkiNAlxFgxzyISpWdkP/gL4rWx0y9T2E2Z8rDbepZgLCQAs2RhXD5my5e4kbtV/fcqTqNF5J0RM6+RY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1725250775; c=relaxed/simple; bh=ixBxpduMq6+X89s1jb+3YxwWxHLWWApPduLkkv3ftcM=; h=DKIM-Signature:Message-ID:Date:MIME-Version:From:To:Subject; b=WDGXqgnMJs+OweU+roLbarLQwgSgujl9Behd2ZMTldQEU0lBW9QX3k5bOwPYc8Vpns+EG+l75p3P8bAWjBIHxJvvYS+kIqXJAbvBDB+fcnu3SdY/kuhjdEyYQPOj6sV6bhm3Wk0k5yemkmsot1iv0ftA6WXJ1ul5vfujMwQbWVI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ot1-x336.google.com with SMTP id 46e09a7af769-70b3b62025dso2682888a34.0 for ; Sun, 01 Sep 2024 21:19:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725250772; x=1725855572; darn=gcc.gnu.org; h=subject:to:from:content-language:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=9MxPNDti0YG/T88/PVDTvxD0POuvuAArSfOGGxpZb40=; b=DE5P7nRbjFIEH0F7cANuKdP4hP+kSmCWZfdLi4ekkGd5IF8WMiv2ds/9MjB7FY3PG1 dMg+YaOgFlc5XtIekQY77LYKW17U/FU2rduTvMKFQfSf/gRyJXvVzvRgc+hPmLaszuLa nlk3bz3TRtINUUJLJpL/QbuLjOnKNDWpc6TyDd93MtLmTCh3flruxy0hCjUzFGwGa2Yf ahXah0EV7/lYHaq7I1a1PCWsyqIcJNFQsE1GUB7s6ZZfX0ib5w1kNmRZKRitXfl8B7KE LwTCJKEjl+R9W1fweOyVVE48fJOGEQfNCd2QZV80cldhwFTOXbzOtncjyRtYnhz0Cvs4 z5hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725250772; x=1725855572; h=subject:to:from:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9MxPNDti0YG/T88/PVDTvxD0POuvuAArSfOGGxpZb40=; b=keWlHrwmDzxrbHmaql4pvKOFSN/1bKKMHJawdYLalciKAUlpIRB/lkBM6Y6JawO4RL xD8uX/AOJYYuhf48LN9fv4o6xIOsqiIfobNm1PBMSOtNbpxfPf0Z5i33vOMT2dmjS1lu DNDVRpIVuLs4q1UCY4dRgozw0u0fD8thzNiXepSw0V9ptifeGA0IIcZYf1GuDjVMF/np qbr9uW+2WKjJBWtYm2wG8gsZh8ul2CKu1S+tw0fDjQv/nDjDMNEFmi08VFJk0DWhOWy8 iOI8eCmqr+GSO6lqsqW+ZQi/vsiVvTtcB/owwki2IcFDfXVLWUVnubuFnnkIzp77v3Fi uDoA== X-Gm-Message-State: AOJu0Ywj37x+xa5xhN2Oeatafo4oPz0V3Mf3PcrfwocKi/6oI7lggCCo wJJGIzLrOYKmzxKFByzljt2SPXVZgiPeiEuFdujullufO+7ShyHkoIfcxw== X-Google-Smtp-Source: AGHT+IF/JUTLWFEe0P7EiT7grC1FVYMR8d45RzLF/GwIaeXDnxj07ep1XI0i5LJ/keK3zskNEEDt2A== X-Received: by 2002:a05:6358:9391:b0:1b5:fb48:e588 with SMTP id e5c5f4694b2df-1b7f1b1b8acmr756904255d.23.1725250771684; Sun, 01 Sep 2024 21:19:31 -0700 (PDT) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2d85b0fe266sm8002383a91.11.2024.09.01.21.19.29 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 01 Sep 2024 21:19:31 -0700 (PDT) Message-ID: <734cff63-894e-417c-a07c-4ce31ef2df2e@gmail.com> Date: Sun, 1 Sep 2024 22:19:27 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US From: Jeff Law To: "gcc-patches@gcc.gnu.org" Subject: [committed][PR rtl-optimization/116544] Fix test for promoted subregs X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 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~incoming=patchwork.ozlabs.org@gcc.gnu.org This is a small bug in the ext-dce code's handling of promoted subregs. Essentially when we see a promoted subreg we need to make additional bit groups live as various parts of the RTL path know that an extension of a suitably promoted subreg can be trivially eliminated. When I added support for dealing with this quirk I failed to account for the larger modes properly and it ignored the case when the size of the inner object was > 32 bits. Opps. This does _not_ fix the outstanding x86 issue. That's caused by something completely different and more concerning ;( Bootstrapped and regression tested on x86. Obviously fixes the testcase on riscv as well. Pushing to the trunk. jeff commit 0562976d62e095f3a00c799288dee4e5b20114e2 Author: Jeff Law Date: Sun Sep 1 22:16:04 2024 -0600 [committed][PR rtl-optimization/116544] Fix test for promoted subregs This is a small bug in the ext-dce code's handling of promoted subregs. Essentially when we see a promoted subreg we need to make additional bit groups live as various parts of the RTL path know that an extension of a suitably promoted subreg can be trivially eliminated. When I added support for dealing with this quirk I failed to account for the larger modes properly and it ignored the case when the size of the inner object was > 32 bits. Opps. This does _not_ fix the outstanding x86 issue. That's caused by something completely different and more concerning ;( Bootstrapped and regression tested on x86. Obviously fixes the testcase on riscv as well. Pushing to the trunk. PR rtl-optimization/116544 gcc/ * ext-dce.cc (ext_dce_process_uses): Fix thinko in promoted subreg handling. gcc/testsuite/ * gcc.dg/torture/pr116544.c: New test. diff --git a/gcc/ext-dce.cc b/gcc/ext-dce.cc index 4a2503f1831..2f3514ae797 100644 --- a/gcc/ext-dce.cc +++ b/gcc/ext-dce.cc @@ -846,7 +846,7 @@ ext_dce_process_uses (rtx_insn *insn, rtx obj, bitmap_set_bit (livenow, rn + 1); if (size > 16) bitmap_set_bit (livenow, rn + 2); - if (size == 32) + if (size >= 32) bitmap_set_bit (livenow, rn + 3); iter.skip_subrtxes (); } diff --git a/gcc/testsuite/gcc.dg/torture/pr116544.c b/gcc/testsuite/gcc.dg/torture/pr116544.c new file mode 100644 index 00000000000..15f52fecb3b --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr116544.c @@ -0,0 +1,22 @@ +/* { dg-options "-fno-strict-aliasing -fwrapv" } +/* { dg-do run { target longlong64 } } */ + +extern void abort (void); +long long a; +signed char b[60]; +signed char c; +long long d[60]; +int e[30]; +long long *f = d; +static void g(long long *j, long k) { *j = k; } +int main() { + d[5] = 0x100000000; + for (int h = 2; h < 7; h += 3) + for (int i = 0; i < (c || b[h]) + 10; i += 11) + e[2] = f[h]; + g(&a, e[2]); + if (a != 0) + abort (); + return 0; +} +