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: 84234 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 C8425385840C for ; Wed, 17 Jan 2024 09:45:10 +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+patchwork=sourceware.org@gcc.gnu.org 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; +}