From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id 1DD533858D39 for ; Fri, 8 Dec 2023 00:24:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1DD533858D39 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 1DD533858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::236 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701995051; cv=none; b=VBXOwA4AGkEmyYy9BhF9NWN7FpwmQ7METhmmWdAXx6qwKxUh2MbH6vJ4zQPAkYTHw8t5Or58sJsBH8fb9saVjn3+VokqKGAKVQwzAX36HpI4fooEaZDGk3QCznUSFF+KPlxxy2w5jfZD+GrwD/hDkcLKyzi6W9DoCdWnRTI1RPI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701995051; c=relaxed/simple; bh=HDYO5o+P7l+0vTalP1N0Rwvt5Om0iEmqdcSO34UKiLA=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=bx4YiTSy4OZ0jxcMc4mr7Whf6RlsimhvwtEwq+A5+gv0etfgfPHpW9GBRMx1MWbj663kk9A/NXUV16OeoC15rhbyJVGfklQLwxysSusDp0+k/ARR5t8cHk+EJaUwrY/Ij/H/HUJ8//BolZTCESA3SFnsvBXbvIW5HKMQ1f1dCsc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oi1-x236.google.com with SMTP id 5614622812f47-3b9dbbaa9a9so1049938b6e.2 for ; Thu, 07 Dec 2023 16:24:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701995047; x=1702599847; darn=gcc.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=pteV0RFDx7u/CPNnzKqMK7G/ivNQNFkzy2UqlUbs6vg=; b=kFn6tmv6e2134NHWG3AyvCiGb7TnjvZxBhHaQD32K6yvvN/K3n/2fpXT5bBxpAHwXB rw+hEbBMB2C0VTFya86RqmK/dsupv82P7WfywUcTC5V9QvYhdcOBgCnnG1fJYRW7aWqO A5WJ94pEWvUUFhaKmD5swo4UzUV24VAcH/0iH+fngp62Ewz05cMZQD/jdCQD7ErISt+3 NfwoM6rarB2LAdFNbM4Re4OjFBXUCffA43wwWyDBzZH3sqX+h2nnb9ajh1J2A30nLL9P VYF/0esKBXxOfsOiVH/Ux6wVJcYIgTklUHG5Ez6z1pM/NzvcMj3AEs8FGa2sIzf+zLdM w8Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701995047; x=1702599847; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pteV0RFDx7u/CPNnzKqMK7G/ivNQNFkzy2UqlUbs6vg=; b=GAiiVToxzHVhTk79tlYX7Khv0rCzgibxbHyw9e1zggRybWa1gD020zBAF6D2SL3wla mHO+FFS8U44wiJkyjQP/LF++yJV3f6qTmiCOj+TeQy+1Y0DwjB//77mwhidmBi4/5kVl R4zzJGcTU/WZHG4wXcnOfx13Nicjxq1vwE+qL+xqiy14nxW8bFGFWasuoEqKB2/l52bw WfWuSFHHBYQsLDh3UKQWs3osJZsE70CQQFfNwm9w+HoqK5X2WNyfDWCfcWGInue3AAfP Zhc83WkKIo104eyre8OiL18DJrO0H+1UA0Rw30/TGRjKRHPu9k4u/xL1UeFslKSCe5kJ 1HAw== X-Gm-Message-State: AOJu0Ywn4L+OOxYGCeZ9mqfGO2XJD5LL8+P/AcQohFKXr0LWD4B9Q+gU jPLKjIlVNCgV/+Va0tZepyI= X-Google-Smtp-Source: AGHT+IEdkzqLnb2QDg/ysM9CqVBqVQQBujiFJ1jXiZs+aqLiL649Mv/SMbrs33/KBAiDj3OajRIk3g== X-Received: by 2002:a05:6808:3c8a:b0:3b8:6057:b087 with SMTP id gs10-20020a0568083c8a00b003b86057b087mr4484912oib.9.1701995047151; Thu, 07 Dec 2023 16:24:07 -0800 (PST) Received: from [172.31.0.109] ([136.36.72.243]) by smtp.gmail.com with ESMTPSA id a6-20020aa78e86000000b006cb6119f516sm355189pfr.163.2023.12.07.16.24.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 16:24:06 -0800 (PST) Message-ID: Date: Thu, 7 Dec 2023 17:24:01 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: NOP_EXPR vs. CONVERT_EXPR Content-Language: en-US To: Richard Biener , Alexander Monakov Cc: gcc@gcc.gnu.org References: From: Jeff Law In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 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,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: On 12/5/23 07:53, Richard Biener via Gcc wrote: > On Tue, Dec 5, 2023 at 3:54 PM Alexander Monakov via Gcc > wrote: >> >> Greetings, >> >> the definitions for NOP_EXPR and CONVERT_EXPR in tree.def, having survived >> all the way from 1992, currently say: >> >> /* Represents a conversion of type of a value. >> All conversions, including implicit ones, must be >> represented by CONVERT_EXPR or NOP_EXPR nodes. */ >> DEFTREECODE (CONVERT_EXPR, "convert_expr", tcc_unary, 1) >> >> /* Represents a conversion expected to require no code to be generated. */ >> DEFTREECODE (NOP_EXPR, "nop_expr", tcc_unary, 1) >> >> Unfortunately, they are confusing, as in >> >> float f(double d) >> { >> return d; >> } >> >> the narrowing conversion is represented with NOP_EXPR, and it is definitely >> not a no-op. >> >> Does some clear distinction remain, and is it possible to clarify the >> definitions? > > {NOP,CONVERT}_EXPR are interchangeable in the middle-end but > frontends (IIRC the C++ FE mainly) distinguishes them. So a uniform > documentation might be difficult - in the end we could eventually > drop NOP_EXPR from the middle-end (during gimplification?) and > only use CONVERT_EXPR. All uses should use CASE_CONVERT > or CONVERT_EXPR_CODE_P which globs both. I thought someone looked at this a while ago (measured in years) and concluded it wasn't actually feasible. Perhaps because the middle end still hands things off to routines that are also used by the FE. I could see dropping/converting during gimplification with a checker that verifies they don't sneak back in. Then we can start to expunge them from gimple passes. Feels like a gcc-15+ problem to me. jeff