From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5014 invoked by alias); 14 Dec 2010 00:20:57 -0000 Received: (qmail 4952 invoked by uid 22791); 14 Dec 2010 00:20:53 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 14 Dec 2010 00:20:46 +0000 Received: by gyh20 with SMTP id 20so31713gyh.20 for ; Mon, 13 Dec 2010 16:20:44 -0800 (PST) Received: by 10.91.11.11 with SMTP id o11mr5904290agi.131.1292286044351; Mon, 13 Dec 2010 16:20:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.90.165.8 with HTTP; Mon, 13 Dec 2010 16:20:04 -0800 (PST) In-Reply-To: References: From: Sebastian Pop Date: Tue, 14 Dec 2010 00:56:00 -0000 Message-ID: Subject: Re: [PATCH, Loop optimizer]: Add logic to disable certain loop optimizations on pre-/post-loops To: "Fang, Changpeng" Cc: "gcc-patches@gcc.gnu.org" , Richard Guenther Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 2010-12/txt/msg01041.txt.bz2 On Mon, Dec 13, 2010 at 14:35, Fang, Changpeng wro= te: > Hi, > > The attached patch adds the logic to disable certain loop optimizations o= n pre-/post-loops. > > Some loop optimizations (auto-vectorization, loop unrolling, etc) may pee= l a few iterations > of a loop to form pre- and/or post-loops for various purposes (alignment,= loop bounds, etc). > Currently, GCC loop optimizer is unable to recognize that such loops will= roll only a few > iterations and still perform optimizations on them. While this does not h= urt the performance in general, > it may significantly increase the compilation time and code size without = performance benefit. > > This patch adds such logic for the loop optimizer to recognize pre- and/o= r post loops, and disable > prefetch, unswitch and loop unrolling on them. On polyhedron with -Ofast = -funroll-loops -march=3Damdfam10, > the patch could reduce the compilation time by 28% on average, the reduce= the binary size by 20% on > =A0average (see the atached data). =A0Note that the small improvement (0.= 5%) could have been noise, the > code size reduction could possibly improve the performance in some cases = (I_cache iprovement?). > > The patch passed bootstrap and gcc regression tests on x86_64-unknown-lin= ux-gnu. > > Is it OK to commit to trunk? I like the way you solved this problem, but I cannot approve your patch. I will let Richi or someone else comment on it. Thanks for fixing this, Sebastian