From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3829 invoked by alias); 11 Jul 2011 08:51:05 -0000 Received: (qmail 3811 invoked by uid 22791); 11 Jul 2011 08:51:03 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mtagate5.uk.ibm.com (HELO mtagate5.uk.ibm.com) (194.196.100.165) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 Jul 2011 08:50:48 +0000 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate5.uk.ibm.com (8.13.1/8.13.1) with ESMTP id p6B8olif004800 for ; Mon, 11 Jul 2011 08:50:47 GMT Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p6B8ok3N2494712 for ; Mon, 11 Jul 2011 09:50:46 +0100 Received: from d06av10.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p6B8okYP012586 for ; Mon, 11 Jul 2011 02:50:46 -0600 Received: from bart (dyn-9-152-224-27.boeblingen.de.ibm.com [9.152.224.27]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id p6B8ojld012532 for ; Mon, 11 Jul 2011 02:50:45 -0600 Received: by bart (sSMTP sendmail emulation); Mon, 11 Jul 2011 10:50:45 +0200 From: "Andreas Krebbel" Date: Mon, 11 Jul 2011 09:36:00 -0000 To: gcc-patches@gcc.gnu.org Subject: [PATCH] Extra invariant motion step after ivopt Message-ID: <20110711085045.GA4003@bart> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg00787.txt.bz2 Hi, with the changes in the IVopts pass from last year I see a reduced number of induction variables used for the first of the 3 hotloops in the 436.cactus benchmark: http://gcc.gnu.org/viewcvs?view=revision&revision=162653 Which leads to an heavily increased number of instructions in the body of the first loop in the resulting binary: with GCC 4.5: BB 4: 52 <- number of instructions with GCC 4.6: BB 4: 110 <- similiar result with GCC head With GCC 4.6 a lot of loop invariant integer arithmetic is done in order to calculate the addresses which are used to access the array fields. Adding another invariant motion pass improves the loop even beyond the 4.5 result: with GCC 4.6 + attached patch: BB 4: 47 The benchmark result for 436.cactus only improves by about 2% since the first loop is not actually the "hottest" in the trio but the code is actually much better. I've not been able to measure the compile time overhead. Out of 10 measurements compiling the cactus testcase the minimum of the compile times was even lower then before. Perhaps having less instructions in the loop body made other passes faster. Overall I expect a very small compile time increase. Ok for mainline? Bye, -Andreas- 2011-07-11 Andreas Krebbel * passes.c (init_optimization_passes): Add invariant motion pass after induction variable optimization. Index: gcc/passes.c =================================================================== *** gcc/passes.c.orig --- gcc/passes.c *************** init_optimization_passes (void) *** 1363,1368 **** --- 1363,1369 ---- NEXT_PASS (pass_parallelize_loops); NEXT_PASS (pass_loop_prefetch); NEXT_PASS (pass_iv_optimize); + NEXT_PASS (pass_lim); NEXT_PASS (pass_tree_loop_done); } NEXT_PASS (pass_cse_reciprocals);