From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22825 invoked by alias); 25 Jun 2014 08:21:26 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 22791 invoked by uid 89); 25 Jun 2014 08:21:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f42.google.com Received: from mail-wg0-f42.google.com (HELO mail-wg0-f42.google.com) (74.125.82.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Wed, 25 Jun 2014 08:21:20 +0000 Received: by mail-wg0-f42.google.com with SMTP id z12so1575462wgg.13 for ; Wed, 25 Jun 2014 01:21:17 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.2.244 with SMTP id 20mr7709071wjx.26.1403684477601; Wed, 25 Jun 2014 01:21:17 -0700 (PDT) Received: by 10.195.11.202 with HTTP; Wed, 25 Jun 2014 01:21:17 -0700 (PDT) In-Reply-To: <2979660.ydMd8y2aAn@polaris> References: <1546601.hgDYK4VNce@polaris> <2979660.ydMd8y2aAn@polaris> Date: Wed, 25 Jun 2014 08:21:00 -0000 Message-ID: Subject: Re: [patch] Do not generate useless integral conversions From: Richard Biener To: Eric Botcazou Cc: GCC Patches Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2014-06/txt/msg01978.txt.bz2 On Tue, Jun 24, 2014 at 11:16 PM, Eric Botcazou wrote: >> I think that was on purpose to avoid arithmetics in enum types. As those >> conversions are useless and thus stripped later is it really important >> to retain enum and boolean kind here? > > The problem is that convert.c is called by front-ends and the patch also > removed the callback into them that made it possible to have some control. > So, yes, it's pretty annoying to see totally bogus conversion nodes being > introduced into your ASTs behind your back... Ok, but the (previous and proposed) behavior is odd as for unsigned_type_for (boolean_type_node) you'd get back a BOOLEAN_TYPE but for unsigned_type_for (signed_type_for (boolean_type_node)) you get back an INTEGER_TYPE. That is, because we use build_nonstandard_integer_type now the result will always be an INTEGER_TYPE (unless you happen to pass in a type with the correct signedness with your patch). I don't like re-introducing that inconsistency. Maybe instead make convert.c do if (!TYPE_UNSIGNED) unsigned_type_for () instead? I notice that all callers of [un]signed_type_for are in "premature" optimizations convert.c performs (that better should be done in fold-const.c). Thanks, Richard. > -- > Eric Botcazou