From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by sourceware.org (Postfix) with ESMTPS id 3FD853858D28 for ; Fri, 12 Jan 2024 16:28:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FD853858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3FD853858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::62c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705076917; cv=none; b=FlD1S+C80ut0suHHwvYzqMWbAM0rS9Ck9L2MwPeqLjS82+4nY7CsqpysjLTqDBQUI/Sgofr4Dt30t62uwMUlsAR0ve5oSwHAgmb2lfc/nShn2d2oQTFJggKQLLmAH8j9dav4AVMCqYEWtnsTCnA10C75TxKIED4KGSVTiisb5K0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705076917; c=relaxed/simple; bh=gKgJyqtMlsljv0Mzq4i2C5rOt4U6HX8BEO70AeAFzX8=; h=DKIM-Signature:From:Mime-Version:Subject:Date:Message-Id:To; b=LyEaDWoEBGzCTOc0KpHBgx9lZG0Z7WebOnnRV7fd+W7QIBFUqNQ0WxJdcujvXfrXWtDGAnh8IwvBJwzoT9xWZANAJTXKEH4qkYhLiCkK9aXkPedOtt/xDCozG+HhgRo6fNWxQ1DrRmnQ+EwPQM98T3UwtqBluiNJ/4q2UChQPD4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a2a225e9449so726620166b.0 for ; Fri, 12 Jan 2024 08:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705076913; x=1705681713; darn=gcc.gnu.org; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:from:to:cc:subject:date:message-id :reply-to; bh=IG/QtijaYwHxaLS/IVA8yGVhQzbN1dLUC+O8NvkJJ4E=; b=DN00GYIsPvyFgC/tClks9c2vnfXH4PyQpnJUqz+UEE3+65f/ivIifsweos4EnykEd8 EukkRD/8lFk9JmejHbVRWE4bdrruMkEDwJKEU0F8R8xlKhzzNAVn8dIcdT/Rx4xu5TWm v8rX4hXihpLqHqVwHUs8Bj3VUJ5VMqF4U+P8N77lz2pONoTd9uIoEvNshfvatYOCQBpJ ZRxpBWKiiWqifEKOR4O3AnU61GSvvqurQeevSHVWDGF3dIvyuL1a9SKap75jrRahj9Jb MQX+Q+Dd4vK0Z1Bj4vag1gnI+/JEHrW7JIiSEC6VtrLZUjSiVQnmM/1J0e5qB7ayI7Ah V/Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705076913; x=1705681713; h=to:in-reply-to:cc:references:message-id:date:subject:mime-version :from:content-transfer-encoding:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IG/QtijaYwHxaLS/IVA8yGVhQzbN1dLUC+O8NvkJJ4E=; b=prCyNmMB/S9oKPfOgPpV8gYrani2fcw2FjpHTupHfU6P5PTDKXF1+1itNc31Zo2UIY NxC51qH07ngi7aY5uJxkvfJqs/yh9YkyMdevU/8xSQgBQsZq6HKKvCWoErOFTn/o8czO xtGrn58cgfJwzBEuuFnTFBQOCl1L0/WUymvfV1n19goR9toF9i8IZ9nSNoi7Auib20GO 1t/ueWveTuRz/0FHP4BNOGv1X+9hmXaA7WL7Al4m9AAHB9N1MojqAlKSQm9/WAySnrfW tx8knBeBQ3JYK8sUq4PXBeJN8LwxZ7ynAdiIVqdDr0JP7xKFGis+IR+s7YyVHKl4GPNL a7EQ== X-Gm-Message-State: AOJu0Yy0lwrzS8hKw4b4oS9tqRp1j3kWqZUljwbRq1p7F2tGA9mia3Jr iTiaHeAV2cfUQ+j9ynJdpDIiLSSjM8M= X-Google-Smtp-Source: AGHT+IFt/ehnAjh05gxlN+GTa19RlCt81r7ULw/R2ZoaaGzdWgDUi2IFOEy85fH8vo5170Q0eW8DOg== X-Received: by 2002:a17:906:f156:b0:a2c:7283:fefb with SMTP id gw22-20020a170906f15600b00a2c7283fefbmr759528ejb.17.1705076912598; Fri, 12 Jan 2024 08:28:32 -0800 (PST) Received: from smtpclient.apple (dynamic-095-117-015-214.95.117.pool.telefonica.de. [95.117.15.214]) by smtp.gmail.com with ESMTPSA id x27-20020a170906299b00b00a2c0fec4240sm1949313eje.158.2024.01.12.08.28.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 12 Jan 2024 08:28:31 -0800 (PST) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Richard Biener Mime-Version: 1.0 (1.0) Subject: Re: HELP: Questions on unshare_expr Date: Fri, 12 Jan 2024 17:28:20 +0100 Message-Id: <70C34042-B741-4697-9524-396CB9D40DF8@gmail.com> References: <50C8811D-9C2A-4FFB-9FC5-D24C5A76F868@oracle.com> Cc: gcc Patches In-Reply-To: <50C8811D-9C2A-4FFB-9FC5-D24C5A76F868@oracle.com> To: Qing Zhao X-Mailer: iPhone Mail (21C66) X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,MIME_QP_LONG_LINE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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 List-Id: > Am 12.01.2024 um 16:55 schrieb Qing Zhao : >=20 > =EF=BB=BFHi, >=20 > I have some questions on using the utility routine =E2=80=9Cunshare_expr=E2= =80=9D: >=20 > =46rom my understanding, there should be NO shared nodes in a GENERIC func= tion. > Otherwise, gimplication might fail. There is sharing and this is why we unshare everything before gimplification= . > Therefore, when we insert new tree nodes manually into the GENERIC functio= n, we should > Make sure there is no shared nodes introduced. >=20 > 1. Is the above understanding correct? No > 2. Is there any tool to check there is no shared nodes in the GENERIC func= tion? > 3. Are there any tree nodes that are allowed to be shared in a GENERIC fun= ction? If so, what are they? There=E2=80=99s some allowed sharing on GIMPLE and a verifier. > 4. For the following: >=20 > If both =E2=80=9Cop1=E2=80=9D and =E2=80=9Cop2=E2=80=9D are existing tree n= odes in the current GENERIC function, > and we will insert a new tree node: >=20 > tree new_tree =3D build2 (CODE, TYPE, op1, op2) >=20 >=20 > Should we add =E2=80=9Cunshare_expr=E2=80=9D on both =E2=80=9Cop1=E2=80=9D= and =E2=80=9Cop2=E2=80=9D as: >=20 > Tree new_tree =3D build2 (CODE, TYPE, unshare_expr (op1), unshare_expr (op= 2)) > ? Not necessarily but instead you have to watch for evaluating side-effects on= ly once. See save_expr. >=20 > If op2 is a node that is allowed to be shared, whether the additional =E2=80= =9Cunshare_expr=E2=80=9D on it trigger any potential problem? If you unshare side-effects that=E2=80=99s generating wrong-code. Otherwise= unsharing is safe. Richard=20 > Thanks a lot for your help. >=20 > Qing >=20 >=20 >=20 >=20 >=20