From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3603 invoked by alias); 8 Oct 2009 16:18:11 -0000 Received: (qmail 3573 invoked by uid 22791); 8 Oct 2009 16:18:10 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Oct 2009 16:18:03 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 29025) id E9359153590; Thu, 8 Oct 2009 18:18:02 +0200 (CEST) Date: Thu, 08 Oct 2009 16:23:00 -0000 From: Zdenek Dvorak To: Jean Christophe Beyler Cc: gcc@gcc.gnu.org Subject: Re: Turning off unrolling to certain loops Message-ID: <20091008161802.GA30141@kam.mff.cuni.cz> References: <20091006065352.GB15626@kam.mff.cuni.cz> <20091006135624.GA18714@kam.mff.cuni.cz> <20091006150918.GA19277@kam.mff.cuni.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg00190.txt.bz2 Hi, > 2) I was using a simple example: > > #pragma unroll 2 > for (i=0;i<6;i++) > { > printf ("Hello world\n"); > } > > If I do this, instead of transforming the code into : > for (i=0;i<3;i++) > { > printf ("Hello world\n"); > printf ("Hello world\n"); > } > > as we could expect, it is transformed into: > for (i=0;i<2;i++) > { > printf ("Hello world\n"); > printf ("Hello world\n"); > } > for (i=0;i<2;i++) > { > printf ("Hello world\n"); > } > > > (I am using 4.3.2 currently) > > I am using the tree_unroll_loop function to perform the unrolling and > it seems to always want to keep that epilogue. Is there a reason for > this? Or is this a bug of some sorts? such an epilogue is needed when the # of iterations is not known in the compile time; it should be fairly easy to modify the unrolling not to emit it when it is not necessary, Zdenek