From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4248 invoked by alias); 11 Jul 2011 12:46:39 -0000 Received: (qmail 4239 invoked by uid 22791); 11 Jul 2011 12:46:39 -0000 X-SWARE-Spam-Status: No, hits=-3.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Jul 2011 12:46:17 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 9D7179D8A6 for ; Mon, 11 Jul 2011 14:46:16 +0200 (CEST) Date: Mon, 11 Jul 2011 14:04:00 -0000 From: Michael Matz To: Richard Guenther Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Make VRP optimize useless conversions In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-IsSubscribed: yes 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 X-SW-Source: 2011-07/txt/msg00808.txt.bz2 Hi, On Mon, 11 Jul 2011, Richard Guenther wrote: > The following actually works. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > Can you double-check it? Seems sensible. Given this: short s; int i; for (s = 0; s <= 127; s++) i += (signed char)(unsigned char)s; return i; (or similar), does it remove the conversions to signed and unsigned char now? And does it _not_ remove them if the upper bound is 128, or the lower bound is -1 ? Similar (now with extensions): signed char c; unsigned u; for (c = 1; c < 127; c++) u += (unsigned)(int)c; The conversion to int is not necessary; but it is when the lower bound is -1. Ciao, Michael.