From patchwork Wed Jan 17 09:44:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 188744 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp796924dye; Wed, 17 Jan 2024 01:45:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlpwHNUox86Z+osfg+Sxo14Up0xKMt1oRbkp7BWKNES99EvXpovJhy2XCQF6x7+rHIk8jD X-Received: by 2002:a37:ad0d:0:b0:781:b188:c7ec with SMTP id f13-20020a37ad0d000000b00781b188c7ecmr644217qkm.74.1705484725411; Wed, 17 Jan 2024 01:45:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705484725; cv=pass; d=google.com; s=arc-20160816; b=O0sVvecZeSRuW7TH3LEXVpgvZ9g9rV2wDkos8Q4jlMyDnk2MrnJIScKVE18YwCI2tK 1UdS58T3LqWWropnWi/qahB7Uu0DjVKA8UDVODfqPC5kYyrmrYpLjNNAua/NieQ2PJbc 5Bsp1GiqkkBT3W+jSgycPr91MCUQDSkT8J0z1X2L48ABoYK59VodSb+QugT9pHaI9MF0 RNLUmB8lpWpC1dN8vn/9zo+dcF7yGqHLAkHb3OmtkHmQW+R51HnPq+ONJfJ0N5MCr/co Eih87lJgdxefouyIgHjwUWI0nwSwfChxnJJblaVdLp30SZZ9R+oOri/49GN58LawltuU pivw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=FBHWd7uWHS9SvL9IKI1HFmVGJSEPv0YEDjNpnSDMKws=; fh=TzwmNZ0Y1lERnRLTMYMokyfE1trpf0pUzyFdns3zHJ8=; b=tsZ9KU3gMOL8cle74Ch7amEj3RRB/PsjnYLylaptrl+2P9JpEiBdksdyEKcET12063 FINgNj1V7bOfuUDXYY4MZQmuRXzsDbRrdwgU0qN4ogntcy0xfkj8i3N0dC0gWcvgZFOd H5Qil39p+QzTQVlcvDE1k+DFpeyGGEeaCwvMRD97ZKXVWZzOxOJD47XAxEsjfEXNCWO9 Jcgah9FxwyAxbRc9fqzztqHlZ0sXasrFjkUw8FIjPEd+ziiM9eCzVK8z184W0ey7Hv7S SkoA7u9drqv9Lk4Ixv2j3nn2bAi+BAU7b5DBZlr/gSmn1nqckxYeT8/rvAyXxEMjKYQ8 J47g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="C/v1wmcE"; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id h17-20020a05620a13f100b0077f4d0ccb58si11129959qkl.453.2024.01.17.01.45.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 01:45:25 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b="C/v1wmcE"; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0BD073858C33 for ; Wed, 17 Jan 2024 09:45:25 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3C39E3858C54 for ; Wed, 17 Jan 2024 09:44:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3C39E3858C54 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3C39E3858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705484682; cv=none; b=fswjNlmQyybE0uPBu9xZbIZSiTEqiQ9W6HBYYUZqfMU237STP3wt0mBdZaCJ7jnrI8U01oU2d/76PoBRt6KUMmel+aMQzq3TPZ7f3P9EQfiosC6cHTpMPqAFn6XC0CGwkQWK5ZlrlCMrekp0dutHLiBvsQjQ3U5qBiYj4fkgywQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705484682; c=relaxed/simple; bh=gF3nqx87zz4FJQM0xL/6LkVfR6bW09BQK/pg8yXQOuI=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=ZanAa4SXngdTgneoHT+6q0VH1jsTRE9uK9oogulcPT7vqUuL4a2lRW1FS7I+ci+SOrlZNvZw63Pz+9FOJ5T/YIvRWwX0RpxztfqCWcah4JO7Jp1dDWhu+2qhVvyK7OpiRFBvRVKOCGn21i+GcE6VCS9VxK3esUngFN+M0C9jgWc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705484679; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=FBHWd7uWHS9SvL9IKI1HFmVGJSEPv0YEDjNpnSDMKws=; b=C/v1wmcESreActnlx0i+zuT/6qxBZJ0rrhAzJo62ovJwEZq1ThTXiDzIsMXcEbbnb/TK3j hrBO+wgY1niYymXYm1YASO0waTtV/UAs3UnMwEfWkeT87F3R6fFYcPJ1IBLyosr6ikjH9M rU/fb5NQLgFyrcDx1Vq0ugbdOfK4xJ8= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-279-IBcCaCyBO2eTcDanYfquEA-1; Wed, 17 Jan 2024 04:44:38 -0500 X-MC-Unique: IBcCaCyBO2eTcDanYfquEA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03EC385A58C; Wed, 17 Jan 2024 09:44:38 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B9C2E51E3; Wed, 17 Jan 2024 09:44:37 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 40H9iZeB2306755 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 10:44:35 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40H9iYJ02306754; Wed, 17 Jan 2024 10:44:34 +0100 Date: Wed, 17 Jan 2024 10:44:33 +0100 From: Jakub Jelinek To: Richard Biener , Alexandre Oliva Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] ipa-strub: Fix handling of _BitInt returns [PR113406] Message-ID: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788330351343497883 X-GMAIL-MSGID: 1788330351343497883 Hi! Seems pass_ipa_strub::execute contains a copy of the expand_thunk code I've changed for _BitInt in r14-6805 PR112941 - larger _BitInts are aggregate_value_p even when they are is_gimple_reg_type. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-17 Jakub Jelinek PR middle-end/113406 * ipa-strub.cc (pass_ipa_strub::execute): Check aggregate_value_p regardless of whether is_gimple_reg_type (restype) or not. * gcc.dg/bitint-70.c: New test. Jakub --- gcc/ipa-strub.cc.jj 2024-01-03 11:51:28.374775006 +0100 +++ gcc/ipa-strub.cc 2024-01-16 10:51:03.987463928 +0100 @@ -3174,21 +3174,16 @@ pass_ipa_strub::execute (function *) resdecl, build_int_cst (TREE_TYPE (resdecl), 0)); } - else if (!is_gimple_reg_type (restype)) + else if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl))) { - if (aggregate_value_p (resdecl, TREE_TYPE (thunk_fndecl))) - { - restmp = resdecl; + restmp = resdecl; - if (VAR_P (restmp)) - { - add_local_decl (cfun, restmp); - BLOCK_VARS (DECL_INITIAL (current_function_decl)) - = restmp; - } + if (VAR_P (restmp)) + { + add_local_decl (cfun, restmp); + BLOCK_VARS (DECL_INITIAL (current_function_decl)) + = restmp; } - else - restmp = create_tmp_var (restype, "retval"); } else restmp = create_tmp_reg (restype, "retval"); --- gcc/testsuite/gcc.dg/bitint-70.c.jj 2024-01-16 11:01:48.300524130 +0100 +++ gcc/testsuite/gcc.dg/bitint-70.c 2024-01-16 11:01:19.456924333 +0100 @@ -0,0 +1,14 @@ +/* PR middle-end/113406 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-std=c23 -fstrub=internal" } */ +/* { dg-require-effective-target strub } */ + +#if __BITINT_MAXWIDTH__ >= 146 +_BitInt(146) +#else +_BitInt(16) +#endif +foo (void) +{ + return 0; +}