Message ID | 20230428094851.5FEE9385771D@sourceware.org |
---|---|
State | Repeat Merge |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp810944vqo; Fri, 28 Apr 2023 02:48:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5cplB7H+DsyxPNaK/wIBx5qihapcvLlklsOowES7C8R+KfPPu6cILk6ZNk+Lam/hJ61x+f X-Received: by 2002:a17:907:a06:b0:953:4481:3305 with SMTP id bb6-20020a1709070a0600b0095344813305mr4470686ejc.24.1682675334102; Fri, 28 Apr 2023 02:48:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682675334; cv=none; d=google.com; s=arc-20160816; b=ZFMEwWFvz5V+gR/7cAR0jDUkEBxRLxce25aBrU9rZGbX5edIac8xEZfdFmelurRP/g k6UmG0pnihCT9/kkkHQlZ/0G1SAmNbPcW5F5plsWW4crd/4hgYNod68e5rHq9IXnKfqh c/XycCKe0xWttZ0/YB6sMj1pHsfCeLWd6XB1nOWK0QJFXJq/J4ACcBsZPjdr9sWNA5Xk UFFsKAs/nEsCWvPol/fKnqTonrAR0FubzXm39OFO01O5AdDOl7QRajr33Nnzd1pu7wqB ERfx3DVcZmq0cB/172cQOz/Yvzrm7K7lQa6TAjDa2kQFkVTZLF/4OTKQWwkp36i59aZn 0t/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=N/cMeAFH0cE+zc/bk0y4yjrkMoXNodN5EsblcC2lcyM=; b=WE7IMoQE/caneO+QjKUyU0fKvikQHDs0qM0uyEGWY9Rgms/Mu/MK+B0YayucqFG7XX X8zaV/UQF5R3newcwvrdU2hr1Q0auLs9Q2Yir777PPowF1cDOQouwKwPMLFQwcP3XL1N 06/wy7HwUrIuAJm6KE63L9at3jCKiqCM10xKuKLSwfreMkF3jMnCBxRFSJlqCrkpGX5J /zr/PNAfRHswNSfMfkDgt95vlvwRw/vP4W4lxE/DEAi/PsIl0B5Hr9xhSWqCfl0nS56h WGHJp/J1i2gVsAcPaehw9J7ZQH6B8lb9aENe/1OyYou1RXunS8ZcTNSFXbpif2En4+1R 7jZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=T58YERda; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ga28-20020a1709070c1c00b0094f693c4d79si17839305ejc.493.2023.04.28.02.48.53 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Apr 2023 02:48:54 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=T58YERda; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5FEE9385771D for <ouuuleilei@gmail.com>; Fri, 28 Apr 2023 09:48:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FEE9385771D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682675331; bh=N/cMeAFH0cE+zc/bk0y4yjrkMoXNodN5EsblcC2lcyM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=T58YERdak3pWmBWt9Gdk3y10rygIBS+2HQXf+wLD0spp7rM0rQ9B/4K4oj0U+6MWK 5NW28yHYTN9WQPZDT4xZDvae1Qwffx1o4YZoXjCDI0KHglmt/hbuPSy0+nkmM+4AtO 9cv1ic5Rn5UvjuzlcLeSTmTZnsehs4X0Fz407/lo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id D47DC3858D37 for <gcc-patches@gcc.gnu.org>; Fri, 28 Apr 2023 09:48:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D47DC3858D37 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id D593F2003B for <gcc-patches@gcc.gnu.org>; Fri, 28 Apr 2023 09:48:01 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id CB87B2C153 for <gcc-patches@gcc.gnu.org>; Fri, 28 Apr 2023 09:48:01 +0000 (UTC) Date: Fri, 28 Apr 2023 09:48:01 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] Avoid more invalid GIMPLE with register bases User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, 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.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> From: Richard Biener via Gcc-patches <gcc-patches@gcc.gnu.org> Reply-To: Richard Biener <rguenther@suse.de> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Message-Id: <20230428094851.5FEE9385771D@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764412971047532364?= X-GMAIL-MSGID: =?utf-8?q?1764412971047532364?= |
Series |
Avoid more invalid GIMPLE with register bases
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Richard Biener
April 28, 2023, 9:48 a.m. UTC
The Ada frontend, for example with gnat.dg/inline2_pkg.adb, tends to create VIEW_CONVERT expressions with aggregate type even of non-aggregate entities. In this case for example return <retval> = (BIT_FIELD_REF <VIEW_CONVERT_EXPR<struct inline2_pkg__ieee_short_real>(number), 16, 16> & 32640) != 32640; currently gimplification and SSA rewrite turn this into _1 = BIT_FIELD_REF <VIEW_CONVERT_EXPR<struct inline2_pkg__ieee_short_real>(number_2(D)); which is two operations on a register. While as seen with PR109652 we might not want to completely rule out register to aggregate type VIEW_CONVERTs we definitely do not want to stack multiple ops here. The solution is to make sure the gimplifier puts a non-register as the base object. For the above this will add number.1 = number; and use number.1 in the compound reference. Code generation is unchanged, FRE optimizes this to BIT_FIELD_REF <number_2(D), ...>. I think BIT_FIELD_REF <VIEW_CONVERT (x), ...> could be always rewritten into BIT_FIELD_REF <x, ...>, but that's a separate thing. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * gimplify.cc (gimplify_compound_lval): When there's a non-register type produced by one of the handled component operations make sure we get a non-register base. --- gcc/gimplify.cc | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc index c38a962dd04..3740a8979af 100644 --- a/gcc/gimplify.cc +++ b/gcc/gimplify.cc @@ -3264,6 +3264,11 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, } need_non_reg = true; } + else if (!is_gimple_reg_type (TREE_TYPE (t))) + /* When the result of an operation, in particular a VIEW_CONVERT_EXPR + is a non-register type then require the base object to be a + non-register as well. */ + need_non_reg = true; } /* Step 2 is to gimplify the base expression. Make sure lvalue is set