From patchwork Tue Oct 9 08:31:15 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 190241 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 362922C00DB for ; Tue, 9 Oct 2012 19:31:40 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1350376301; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=POt3QPiJWMHSnQo7GI+fa7FbF5M=; b=Q8duSoQAjpG0BCP /dKsZLb7E7L4fShD/P3dMuhtcx9W7nnA0HTB1IyAvLcBaD5H0KQMrrnNh5/r+8Wb Sh0hdWs1X4yts3BL7ofmAAEbCxoS5fYFGN5D5mCGtAFQZzBFska15Jc+l5EOgy5N 91YxJq/4q/VCQGok9WR8dpcelKAE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=j23TgnCvMOBvxhAJBFMVCbTLu87bOWwSxSFGd1KnKmTw3LhsNi0zsgclyuEY7z gFRndlhHv8XFDvo0zFtAWPAA9ucmYcxjF++hDk5SqI51/slFpxavszjyOrqhEJiO u4bF3QKz3UIU8bjJMhu9YVnoWIGA07hoMY8Uw0q6h5b18=; Received: (qmail 30012 invoked by alias); 9 Oct 2012 08:31:30 -0000 Received: (qmail 29993 invoked by uid 22791); 9 Oct 2012 08:31:23 -0000 X-SWARE-Spam-Status: No, hits=-4.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Oct 2012 08:31:19 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id B1898543533; Tue, 9 Oct 2012 10:31:15 +0200 (CEST) Date: Tue, 9 Oct 2012 10:31:15 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Fix my change to unroll_loop_constant_iterations Message-ID: <20121009083115.GA32592@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org H, I hope this change is responsible for today misoptimizations of SPEC at -O3. While updating unroll_loop_constant_iterations and fighting with double_int operations I made two trivial mistakes. I am bootstrapping/regtesting the following and will commit it as obvious if it passes. Honza * loop-unroll.c (unroll_loop_constant_iterations): Fix previous patch. Index: loop-unroll.c =================================================================== --- loop-unroll.c (revision 192239) +++ loop-unroll.c (working copy) @@ -740,6 +740,7 @@ unroll_loop_constant_iterations (struct apply_opt_in_copies (opt_info, exit_mod + 1, false, false); desc->niter -= exit_mod + 1; + loop->nb_iterations_upper_bound -= double_int::from_uhwi (exit_mod + 1); if (loop->any_estimate && double_int::from_uhwi (exit_mod + 1).ule (loop->nb_iterations_estimate)) @@ -795,12 +796,12 @@ unroll_loop_constant_iterations (struct desc->niter /= max_unroll + 1; loop->nb_iterations_upper_bound - = loop->nb_iterations_upper_bound.udiv (double_int::from_uhwi (exit_mod + = loop->nb_iterations_upper_bound.udiv (double_int::from_uhwi (max_unroll + 1), FLOOR_DIV_EXPR); if (loop->any_estimate) loop->nb_iterations_estimate - = loop->nb_iterations_estimate.udiv (double_int::from_uhwi (exit_mod + = loop->nb_iterations_estimate.udiv (double_int::from_uhwi (max_unroll + 1), FLOOR_DIV_EXPR); desc->niter_expr = GEN_INT (desc->niter);