From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by sourceware.org (Postfix) with ESMTPS id 90C073858D39 for ; Thu, 21 Sep 2023 19:48:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 90C073858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x42a.google.com with SMTP id ffacd0b85a97d-31dd10c2b8bso1349246f8f.3 for ; Thu, 21 Sep 2023 12:48:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695325701; x=1695930501; darn=gcc.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nCn+YV07iR555/e05XHlKXBF+hN4nEnoNYK4E2wmAM0=; b=WmSPncHIpSfWBwV7ZVstinTH+upXcpAr9jTIvMoHDGzL2IqLca4K8hJCAKt8Zz2cK7 B9ljKUeH+e3BMVf1CzZtBJVfzxMGM2wcTxpAL10z4wozC04qNe+DShQUd9+Y4wF5l2UL w6Dwo9Yr4AeBB5MwhT0CvHbk18FlAxwY4GRKAfOKlqECLhhCV5UKRP/9J015RPM3UHl2 r9epFbW1rtkNXwDEw+b9s/2MMrPX48/XEEygriKQECN5JtSWvfm0STBuRL45eYyexRO/ /iQkoceNWpQoX/IRBNbqBUKlRtwyJKA2Mgvw6XYHjsybHKWUlOESxOR5jp6Iu8FA7du8 yR4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695325701; x=1695930501; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nCn+YV07iR555/e05XHlKXBF+hN4nEnoNYK4E2wmAM0=; b=PfDxH+j1Qi4E/I+FYLQcwuqpUdySB/uwSwm86B71mAzgvVtTjcKzz6CKCgqNb0Mgly tSAkBDuGnMnjT747VUiRCLXXtDDdZ5dhiH2do/WlNy34e9ddaxs59yDy4dcI+TU3J3Z0 /jrwREFe3wrMZgylHasnqSq7cgQUj6kjEFsjy+1EgxyGhxRexVsmRQAMuQenL3Lbibrj dFOSXLF/Ttvw+p++PIP6QRpWZWC/0nT/GD3r5r8Bri4ct/DC7s92qY7IuAmduIwMvNQf blg4h8kDvq3sgGNj4iqnj+5Q8TnddmOIpMZuTm7nV1mz5S/1/3r5oIIQd+4HnDOsUHz0 DL/A== X-Gm-Message-State: AOJu0YxSLHSkgsParjKZtCF6VyzSlsAUlLhM5GuIKKCUqS0/WH6Ui89J SCxcB/DiAcRvTAhwbE9TnJRM+cUXc69GUIP3lFQ= X-Google-Smtp-Source: AGHT+IGWHYzzeFUooB1VPgrVwmlSAlYOfZBZV3HXNe0mDNlZ92iDJqovtBPtQhhgt5c6/FHKCpKtP4xmkJ+cXNdxJbI= X-Received: by 2002:a05:6000:16cd:b0:321:71ae:736c with SMTP id h13-20020a05600016cd00b0032171ae736cmr6893495wrf.7.1695325700829; Thu, 21 Sep 2023 12:48:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Guillaume Gomez Date: Thu, 21 Sep 2023 21:48:09 +0200 Message-ID: Subject: Re: Handling of nonnull function attribute To: Antoni Boucher Cc: gcc@gcc.gnu.org, David Malcolm Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, We were able to make it work by calling: ``` decl_attributes (&fndecl, fn_attributes, 0); ``` We used to set the attributes directly in `fndecl` using equivalents of: ``` DECL_ATTRIBUTES (fndecl) =3D tree_cons (ident, attribute_value, DECL_ATTRIBUTES (fndecl)); ``` We now store inside `fn_attributes` using: ``` fn_attributes =3D tree_cons (ident, attribute_value, fn_attributes); ``` Like this, the function attributes seem to be correctly set and the optimization is triggered as expected when using the `nonnull` attribute. I think with this it's all good. If you see something we did wrong, please don't hesitate to tell us. Le jeu. 21 sept. 2023 =C3=A0 16:48, Antoni Boucher a =C3= =A9crit : > > Hi. > I'm working on adding the support for the nonnull attribute in > libgccjit. > I found out a way to make it working, but I need more help to find a > proper solution. > The problem is that the nonnull attribute should be added to the > fn_type while we added it to the fn_decl. > If we add it to the fn_type directly, it works. > However, it seems the other frontends do that automatically, by the way > of c_common_attribute_table (field type_required set to true). > Is this correct? > If so, how does this mechanism work and how can it be enabled for a > frontend? > I tried calling init_attributes at the end of jit_langhook_init, but > that doesn't work. > Thanks for your help.