From patchwork Wed Jan 31 11:18:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 1893405 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=CRj09fgJ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TQ00d1TPdz23g7 for ; Wed, 31 Jan 2024 22:18:55 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 492ED3858D32 for ; Wed, 31 Jan 2024 11:18:53 +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 632533858D1E for ; Wed, 31 Jan 2024 11:18:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 632533858D1E 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 632533858D1E 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=1706699914; cv=none; b=D81Cx4Ofhr+NperQ6DHozGCOqQUTgxhBzxMjuUCoBiRLl0Tb0qUHAkD/1cwjotDx/6MgL1tFXRMNB9jg5Bf25d22nwQPh7kqNgs2AX9J/R9+0tycKJqsQwoEPPqLQTn3cmeMbZyzUBzTZAOfoBnnnnMcwxiLam15pAnFH5wxVCU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706699914; c=relaxed/simple; bh=P2yZMjGlM/06/5d+a/qrZ4NxX9xZ1jRIUgTmfq+sQ1M=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=mfrcAioRjKkFX3/GZmRRK8Hlur56/jzaAtGGC49M1dFwpUdkdLAZBp4anurtyhzuz1xc71yHiC4DrrDqwiGBnF4HHoBlT5JhmBCqirOVEuun4vL0xvsldpbT4q2Z9JMczRmutvrKpXjGBtQ3eg6YI14HuztQXS7v+EG32VljeZM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706699903; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=b7YOa45wcTx2jxDjcaWZrNe4WTxJ84OFnyt6nNkzAc0=; b=CRj09fgJpI8n86c3sjNcFWJB13ypxjZxpcs5YB76x9cNjhrWhXWw86+SStyWLng4oXySKd mtpmRhcUC2VhcXN2rVY++k+4JHRUiQbwCFI0/rD1d7dThyj69zGZHnuZsH6EgF+vOrF9Jb 883GJ3s2BnzNp3s01CdIdOmkC3u4q+U= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-104-3BRPH8ISMeOYwD7JHvzvZg-1; Wed, 31 Jan 2024 06:18:19 -0500 X-MC-Unique: 3BRPH8ISMeOYwD7JHvzvZg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 4D2512806410; Wed, 31 Jan 2024 11:18:19 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04A84C1ED64; Wed, 31 Jan 2024 11:18:18 +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 40VBIGMd271562 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 12:18:16 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40VBIFr4271561; Wed, 31 Jan 2024 12:18:15 +0100 Date: Wed, 31 Jan 2024 12:18:15 +0100 From: Jakub Jelinek To: Richard Biener , Jason Merrill , gcc-patches@gcc.gnu.org Subject: [PATCH] gimple-fold: Remove .ASAN_MARK calls on TREE_STATIC variables [PR113531] Message-ID: References: <20240131033759.2236614-1-jason@redhat.com> MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 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_H3, 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+incoming=patchwork.ozlabs.org@gcc.gnu.org On Wed, Jan 31, 2024 at 10:07:28AM +0100, Jakub Jelinek wrote: > Indeed. But what we could do is try to fold_stmt those .ASAN_MARK calls > away earlier (but sure, the asan.cc change would be still required because > that would be just an optimization). But that can be handled incrementally, > so I think the patch is ok as is (and I can handle the incremental part > myself). Like this, so far just tested on the testcase. Ok for trunk if it passes bootstrap/regtest on top of Jason's patch? 2024-01-31 Jakub Jelinek PR c++/113531 * gimple-fold.cc (gimple_fold_call): Remove .ASAN_MARK calls on variables which were promoted to TREE_STATIC. Jakub --- gcc/gimple-fold.cc.jj 2024-01-03 11:51:27.236790799 +0100 +++ gcc/gimple-fold.cc 2024-01-31 12:09:14.853348505 +0100 @@ -5722,6 +5722,21 @@ gimple_fold_call (gimple_stmt_iterator * } } break; + case IFN_ASAN_MARK: + { + tree base = gimple_call_arg (stmt, 1); + gcc_checking_assert (TREE_CODE (base) == ADDR_EXPR); + tree decl = TREE_OPERAND (base, 0); + if (VAR_P (decl) && TREE_STATIC (decl)) + { + /* Don't poison a variable with static storage; it might have + gotten marked before gimplify_init_constructor promoted it + to static. */ + replace_call_with_value (gsi, NULL_TREE); + return true; + } + } + break; case IFN_GOACC_DIM_SIZE: case IFN_GOACC_DIM_POS: result = fold_internal_goacc_dim (stmt);