From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25036 invoked by alias); 5 Jan 2007 07:46:26 -0000 Received: (qmail 25026 invoked by uid 22791); 5 Jan 2007 07:46:26 -0000 X-Spam-Check-By: sourceware.org Received: from atrey.karlin.mff.cuni.cz (HELO atrey.karlin.mff.cuni.cz) (195.113.31.123) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 05 Jan 2007 07:46:21 +0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 29025) id DC4AEC7DC5; Fri, 5 Jan 2007 08:46:18 +0100 (CET) Date: Fri, 05 Jan 2007 07:46:00 -0000 From: Zdenek Dvorak To: Robert Kennedy Cc: Richard Guenther , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fold more aggressively for trip counts Message-ID: <20070105074618.GA24087@atrey.karlin.mff.cuni.cz> References: <17821.22245.42440.581996@whippen.corp.google.com> <20070104225900.GA28248@atrey.karlin.mff.cuni.cz> <17821.42827.894677.761668@whippen.corp.google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <17821.42827.894677.761668@whippen.corp.google.com> User-Agent: Mutt/1.5.9i 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: 2007-01/txt/msg00348.txt.bz2 Hello, > > I am not sure making tree_simplify_using_condition > > more complex is a good idea -- for what kind of expressions do you > > need this change? > > We discussed this a little bit privately in the past, but I don't > think I made clear the connection between that discussion and this > change. The situation is that you have a trip-countable loop guarded > by an if condition, and after SR/LFTR, the loop termination test is > replaced but the guard is not. As a result, slightly more > sophistication is needed to compute the trip count for the loop while > taking into account the guard. > > Example: > > for (i = 0; i < n; i++) > body(i * 4); > > becomes: > > if (n > 0) > { > i = 0; > do > { > body(i * 4); > i++; > } > while (i < n); > } > > In that form, the do {} while loop is trip-countable without my change > because the (n > 0) guard proves easily that n cannot be negative > inside the "then" block. > > But now with SR/LFTR, the code becomes: > > if (n > 0) > { > osrtemp.i = 0; > osrtemp.n = n * 4; > do > { > body(osrtemp.i); > osrtemp.i += 4; > } > while (osrtemp.i < osrtemp.n); > } > > If the trip count needs to be computed after such a transformation, my > change is needed because now the loop termination test involves > variables different from the ones in the guarding "if" condition. perhaps making expand_simple_operations consider multiplication by a constant to be simple would work as well, at least for this testcase? > > Also, I think you should provide some measurements supporting the > > need for this change -- i.e., verify that it does not increase > > compile time... > > What is the accepted way of measuring compile time? I usually measure how long it takes to compile preprocessed gcc sources (although I would hardly claim that this is "the accepted way of measuring compile time"), Zdenek