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: 194687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1815873dyb; Wed, 31 Jan 2024 03:19:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJXfWFDdOjOu0bgRxl2/GmUc2o2vDByw3DYzDnXuw86dfxZYANbZkButKecNICu5HyKDln X-Received: by 2002:a05:622a:12:b0:42a:4e51:985f with SMTP id x18-20020a05622a001200b0042a4e51985fmr4290111qtw.31.1706699955398; Wed, 31 Jan 2024 03:19:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706699955; cv=pass; d=google.com; s=arc-20160816; b=pNCELufN8FqOUbOqDqR3xx2CkDMepzz1RJVQB6GhevcsG2Rac/gXIXArbOhzs0g1pf 4FMzeSJaGH2qhR3j9LN0GqknY8Wgjwr5YWIkB9+5ukpkKKLK0BAfYA6+77hnlDVGRt5E nrZm6zrvRRAI4a7QCy9WNTswAYZuyTw0AroXo5wh6Lrpq0Dp6mkysPTqVxryqzWx939B 757lMun6asSftCxFOz5pKaYbjRYn3QqnMLUSIoAHd5YR6vgnbFPFGjNjSQlfja364nSq bul7MXXaOF+T27+MGRSQ8L+b9O6ksL8tsSx0eJRJ59A9+PdvTNFhZMK3KssHhD87hjtK 29qA== 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:in-reply-to :mime-version:references:message-id:subject:to:from:date :dkim-signature:arc-filter:dmarc-filter:delivered-to; bh=b7YOa45wcTx2jxDjcaWZrNe4WTxJ84OFnyt6nNkzAc0=; fh=jfMvRgAfEFhe2yo9KZYk28Nakq/LgvQKFXmnqtsT0G8=; b=pO1/+JMlHkCUDA4wYHVMb+VoIfBUXADqmO2SRFWv3qLKw5Fh3XDUgVvSAiRntcw365 vFQzaqiuTdMz/QDkHMZeSTE902gEQYy0BKqqb5dbhzM2caU0xfwnTJF/onZkL9NTn/x/ Enb/zIHqNwpAgZEakrcdelUMOydWgfIK+xz6oy45TLVYi2Iykp07xopad+8QfJcNO+M3 QFXoXjBXTD7v3UEF1VNmF958oj84R2Ytny+BEZ2IbMdHCHqmZl/o6/+CZSebQJCfmAl7 3KkQWdd44QQniTaoXJWSO3E0a5xqRYLg6Bf3E52pHWiEVLerfII4Hqd4CgWAhiBZcah6 5JDw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CRj09fgJ; 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 X-Forwarded-Encrypted: i=1; AJvYcCVFNlKaHfvxaO1Q/2+qZhAAZSgB/x0O1IOhGi0CjDykaqKMBhdR2GEyUdJEGRlfLNBQpcSKPTgA8r0XC/VqznazRwPB3A== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d9-20020a05622a100900b0042beea1c738si164429qte.740.2024.01.31.03.19.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 03:19:15 -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=CRj09fgJ; 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 EDA0B3858D1E for ; Wed, 31 Jan 2024 11:19:14 +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+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789604612563262837 X-GMAIL-MSGID: 1789604612563262837 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);