Message ID | ZXl3pyJVPCP9L521@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp7647594dys; Wed, 13 Dec 2023 01:22:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFt5T8zcjzRM50GXgzs6teVDgUwr+dIA4gBh/ueZG3W5Yo/6kq43yOnB3OylMfxV7DxGpOe X-Received: by 2002:a05:620a:4606:b0:77f:3d4a:6dc0 with SMTP id br6-20020a05620a460600b0077f3d4a6dc0mr9747719qkb.30.1702459338889; Wed, 13 Dec 2023 01:22:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1702459338; cv=pass; d=google.com; s=arc-20160816; b=woiV9ViNyE+ClaTBCwt7bzFkB5PovgTFxAunripR6IYeuiaybvWV8STQwvCU5LAykI qfvriqXaMx84jrS19Wyncci7wvGf5CBMdG7mlWqNs/sPJFdB9HBJQyZZQim83Vco9JgB pqU5ftqWmHVpF4KtSZ2ZbsYVcgdODQzJ1eVv1pJwP/p+4uSZAnuxTyPJQnGD1HVzpyHw V22U5cT9dOVT4GedsfOSmBkHjGofaBl06u5Ss07w7yMY37NkhLBXov4R6vR/gsBaW4de xt/QRWh2Pp7E3RkuulSxCZqHao+Bl+iwFMzSF7NUA6I66Pgeh0nxSczg6Y/dsyfH84Fk TsOw== 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=4Kv8oqlQXxNlC1fRJPklcP5nhf+LJpwqTSeUSRniX5c=; fh=Sumi7UGVVY0GzlCcoxP/I2lPIv2cWAA+7toE9bDwbbU=; b=ic83RyC10uZO/UkfGsHROmn48hpwZutEdqt4xqxDqCxelNmG62uGtDGbdQrKu93LqD RKGcozPG8Q79nOyiXu7IAipRokiKIDTM9aJa8x0VdIQwm84q6meYsMdbXk7pZ9kUjtOp WGhLcUuWCaINwiEOcQzmWNFVXQg30Ph4EEvlb9JUs9uWy7/cVPzLXAt11C2EWEqbN5GG bIFk8j++2NI233xE7tUqDnTTkQsBKWuf1x4QDnWvwERtf6iXEQwdpCQ/Jb7szO4DDsoV UJvxXpRfKCX/Kwsp/WWJlfcltT7e6TjVP0E4gVClO+UkHzNZQ5O7YJvK9LNu6ylzEowS EHXQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H2LVJhpo; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s17-20020a05620a255100b0077dc688e217si12339001qko.406.2023.12.13.01.22.18 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 01:22:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=H2LVJhpo; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 8DC26385DC26 for <ouuuleilei@gmail.com>; Wed, 13 Dec 2023 09:22:18 +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.133.124]) by sourceware.org (Postfix) with ESMTPS id 9E285385DC31 for <gcc-patches@gcc.gnu.org>; Wed, 13 Dec 2023 09:21:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9E285385DC31 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 9E285385DC31 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702459311; cv=none; b=PqXz4ftXC3r7vpQ62tVZeOt23UFqFeQrh3Xp2CQZiC2/E1j+h9wjnUne16quz2oL01gHhBH/Yit9Hv+IC2vO6jl9U/a3KANya5vsdhEwJwH2ObH5trvq8+FjeXD7MdrnkxbIRkzw8CrM9dCoeScWPfy1rMci0lc/AnzpHclXtXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702459311; c=relaxed/simple; bh=NMV7uvoMo1aY3655wlW03VBlA6/WAh3TXqDEDZwKOXA=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=M0XMG1HWqdWs6I+06mIGn4MvXy5S8corg5ZNElFTJOpKCkdNpTLfeChKGrG+KLNV8h20xD/iVycHyy8RMtZwE7NJzF9+0Qd4h1KimIAeIAA32ByrUDpW9SDNVY/3SF4ry9ZR9zdjNeInY8uKJOOtBrywQDWMMVjQyuJHTfbLk4g= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702459308; 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=4Kv8oqlQXxNlC1fRJPklcP5nhf+LJpwqTSeUSRniX5c=; b=H2LVJhpoRBCgtAa8TCMo6o615Z2Gao0m13w4LP67MrEdalwGG2jDcHSIt2odBiiYd60bq0 FMzZWt45d8oknR7opl+wB4kOv9SusPWCujSId5/6nOSiuAZhs86x3pJlpsM0RxJweTR5Pk f/qVuTH13uRdzEW9i2vFNmMlaF8tvXI= 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-612-7bmwB62yMQukA3WYTGGEkg-1; Wed, 13 Dec 2023 04:21:47 -0500 X-MC-Unique: 7bmwB62yMQukA3WYTGGEkg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 BEFEE8871C2; Wed, 13 Dec 2023 09:21:46 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8300C1121306; Wed, 13 Dec 2023 09:21:46 +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 3BD9LhVH2489750 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 13 Dec 2023 10:21:44 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 3BD9LhEa2489749; Wed, 13 Dec 2023 10:21:43 +0100 Date: Wed, 13 Dec 2023 10:21:43 +0100 From: Jakub Jelinek <jakub@redhat.com> To: Uros Bizjak <ubizjak@gmail.com>, Hongtao Liu <crazylht@gmail.com> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] i386: Make most MD builtins nothrow, leaf [PR112962] Message-ID: <ZXl3pyJVPCP9L521@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, MEDICAL_SUBJECT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no 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 <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> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785158003849353499 X-GMAIL-MSGID: 1785158003849353499 |
Series |
i386: Make most MD builtins nothrow, leaf [PR112962]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Dec. 13, 2023, 9:21 a.m. UTC
Hi! The following patch makes most of x86 MD builtins nothrow,leaf (like most middle-end builtins are). For -fnon-call-exceptions it doesn't nothrow, better might be to still add it if the builtins don't read or write memory and can't raise floating point exceptions, but we don't have such information readily available, so the patch uses just !flag_non_call_exceptions for now. Not sure if we shouldn't have some exceptions for the leaf attribute, e.g. wonder about EMMS/FEMMS and the various xsave/xrstor etc. builtins, pedantically none of those builtins do anything that leaf functions are forbidden to do (having callbacks, calling functions from current TU, longjump into the current TU), but sometimes non-leaf is also used on really complex functions to prevent some unwanted optimizations. That said, haven't run into any problems as is with the patch. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2023-12-13 Jakub Jelinek <jakub@redhat.com> PR target/112962 * config/i386/i386-builtins.cc (ix86_builtins): Increase by one element. (def_builtin): If not -fnon-call-exceptions, set TREE_NOTHROW on the builtin FUNCTION_DECL. Add leaf attribute to DECL_ATTRIBUTES. (ix86_add_new_builtins): Likewise. Jakub
Comments
Hi! On Wed, Dec 13, 2023 at 10:21:43AM +0100, Jakub Jelinek wrote: > The following patch makes most of x86 MD builtins nothrow,leaf > (like most middle-end builtins are). For -fnon-call-exceptions it > doesn't nothrow, better might be to still add it if the builtins > don't read or write memory and can't raise floating point exceptions, > but we don't have such information readily available, so the patch > uses just !flag_non_call_exceptions for now. > Not sure if we shouldn't have some exceptions for the leaf attribute, > e.g. wonder about EMMS/FEMMS and the various xsave/xrstor etc. builtins, > pedantically none of those builtins do anything that leaf functions > are forbidden to do (having callbacks, calling functions from current TU, > longjump into the current TU), but sometimes non-leaf is also used on > really complex functions to prevent some unwanted optimizations. > That said, haven't run into any problems as is with the patch. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2023-12-13 Jakub Jelinek <jakub@redhat.com> > > PR target/112962 > * config/i386/i386-builtins.cc (ix86_builtins): Increase by one > element. > (def_builtin): If not -fnon-call-exceptions, set TREE_NOTHROW on > the builtin FUNCTION_DECL. Add leaf attribute to DECL_ATTRIBUTES. > (ix86_add_new_builtins): Likewise. I'd like to ping this patch. Bootstrapped/regtested fine again last night. Jakub
On Wed, Dec 13, 2023 at 10:21 AM Jakub Jelinek <jakub@redhat.com> wrote: > > Hi! > > The following patch makes most of x86 MD builtins nothrow,leaf > (like most middle-end builtins are). For -fnon-call-exceptions it > doesn't nothrow, better might be to still add it if the builtins > don't read or write memory and can't raise floating point exceptions, > but we don't have such information readily available, so the patch > uses just !flag_non_call_exceptions for now. > Not sure if we shouldn't have some exceptions for the leaf attribute, > e.g. wonder about EMMS/FEMMS and the various xsave/xrstor etc. builtins, > pedantically none of those builtins do anything that leaf functions > are forbidden to do (having callbacks, calling functions from current TU, > longjump into the current TU), but sometimes non-leaf is also used on > really complex functions to prevent some unwanted optimizations. > That said, haven't run into any problems as is with the patch. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? > > 2023-12-13 Jakub Jelinek <jakub@redhat.com> > > PR target/112962 > * config/i386/i386-builtins.cc (ix86_builtins): Increase by one > element. > (def_builtin): If not -fnon-call-exceptions, set TREE_NOTHROW on > the builtin FUNCTION_DECL. Add leaf attribute to DECL_ATTRIBUTES. > (ix86_add_new_builtins): Likewise. LGTM. Thanks, Uros. > > --- gcc/config/i386/i386-builtins.cc.jj 2023-10-13 19:34:43.767837029 +0200 > +++ gcc/config/i386/i386-builtins.cc 2023-12-12 12:20:50.980071085 +0100 > @@ -221,7 +221,7 @@ ix86_get_builtin_func_type (enum ix86_bu > } > > /* Table for the ix86 builtin decls. */ > -static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX]; > +static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX + 1]; > > struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX]; > > @@ -295,6 +295,12 @@ def_builtin (HOST_WIDE_INT mask, HOST_WI > NULL, NULL_TREE); > ix86_builtins[(int) code] = decl; > ix86_builtins_isa[(int) code].set_and_not_built_p = false; > + if (!flag_non_call_exceptions) > + TREE_NOTHROW (decl) = 1; > + if (ix86_builtins[(int) IX86_BUILTIN_MAX] == NULL_TREE) > + ix86_builtins[(int) IX86_BUILTIN_MAX] > + = build_tree_list (get_identifier ("leaf"), NULL_TREE); > + DECL_ATTRIBUTES (decl) = ix86_builtins[(int) IX86_BUILTIN_MAX]; > } > else > { > @@ -393,6 +399,12 @@ ix86_add_new_builtins (HOST_WIDE_INT isa > TREE_READONLY (decl) = 1; > if (ix86_builtins_isa[i].pure_p) > DECL_PURE_P (decl) = 1; > + if (!flag_non_call_exceptions) > + TREE_NOTHROW (decl) = 1; > + if (ix86_builtins[(int) IX86_BUILTIN_MAX] == NULL_TREE) > + ix86_builtins[(int) IX86_BUILTIN_MAX] > + = build_tree_list (get_identifier ("leaf"), NULL_TREE); > + DECL_ATTRIBUTES (decl) = ix86_builtins[(int) IX86_BUILTIN_MAX]; > } > } > > > Jakub >
--- gcc/config/i386/i386-builtins.cc.jj 2023-10-13 19:34:43.767837029 +0200 +++ gcc/config/i386/i386-builtins.cc 2023-12-12 12:20:50.980071085 +0100 @@ -221,7 +221,7 @@ ix86_get_builtin_func_type (enum ix86_bu } /* Table for the ix86 builtin decls. */ -static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX]; +static GTY(()) tree ix86_builtins[(int) IX86_BUILTIN_MAX + 1]; struct builtin_isa ix86_builtins_isa[(int) IX86_BUILTIN_MAX]; @@ -295,6 +295,12 @@ def_builtin (HOST_WIDE_INT mask, HOST_WI NULL, NULL_TREE); ix86_builtins[(int) code] = decl; ix86_builtins_isa[(int) code].set_and_not_built_p = false; + if (!flag_non_call_exceptions) + TREE_NOTHROW (decl) = 1; + if (ix86_builtins[(int) IX86_BUILTIN_MAX] == NULL_TREE) + ix86_builtins[(int) IX86_BUILTIN_MAX] + = build_tree_list (get_identifier ("leaf"), NULL_TREE); + DECL_ATTRIBUTES (decl) = ix86_builtins[(int) IX86_BUILTIN_MAX]; } else { @@ -393,6 +399,12 @@ ix86_add_new_builtins (HOST_WIDE_INT isa TREE_READONLY (decl) = 1; if (ix86_builtins_isa[i].pure_p) DECL_PURE_P (decl) = 1; + if (!flag_non_call_exceptions) + TREE_NOTHROW (decl) = 1; + if (ix86_builtins[(int) IX86_BUILTIN_MAX] == NULL_TREE) + ix86_builtins[(int) IX86_BUILTIN_MAX] + = build_tree_list (get_identifier ("leaf"), NULL_TREE); + DECL_ATTRIBUTES (decl) = ix86_builtins[(int) IX86_BUILTIN_MAX]; } }