From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19033 invoked by alias); 13 Mar 2004 09:24:39 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 19026 invoked from network); 13 Mar 2004 09:24:38 -0000 Received: from unknown (HELO atrey.karlin.mff.cuni.cz) (195.113.31.123) by sources.redhat.com with SMTP; 13 Mar 2004 09:24:38 -0000 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 29025) id 180304C034A; Sat, 13 Mar 2004 10:24:38 +0100 (CET) Date: Sat, 13 Mar 2004 09:24:00 -0000 From: Zdenek Dvorak To: Devang Patel Cc: "gcc@gcc.gnu.org list" , Jason Merrill , Dorit Naishlos , Richard Henderson , Diego Novillo Subject: Re: [lno] [RFC] if-conversion and auto vectorizer Message-ID: <20040313092438.GA6767@atrey.karlin.mff.cuni.cz> References: <415253BF-7455-11D8-A347-000393A91CAA@apple.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <415253BF-7455-11D8-A347-000393A91CAA@apple.com> User-Agent: Mutt/1.5.4i X-SW-Source: 2004-03/txt/msg00600.txt.bz2 Hello, > OK. So far I have coded transformation to transform > > bar () > { > int A[N+1], B[N+1], C[N+1], D[N+1]; > int i; > > for (i = 1; i { > if (A[i] > 0) > { > A[i] = A[i] + C[i]; > B[i] = A[i] + 1; > } > else > { > A[i] = D[i]; > B[i] = D[i] + 1; > } > } > ibar(A); > ibar(B); > } > > into : > > bar () > { > int i; > int D[17]; > int C[17]; > int B[17]; > int A[17]; > int T.5; > int T.4; > int T.3; > int T.2; > int T.1; > int T.0; > > # BLOCK 0 > # PRED: ENTRY [100.0%] (fallthru,exec) > # SUCC: 1 [100.0%] (fallthru,exec) > > # BLOCK 1 > # PRED: 6 [100.0%] (fallthru) 0 [100.0%] (fallthru,exec) > # i_1 = PHI <1(0), i_15(6)>; > :; > T.0_3 = if (1) > { > A[i_1]; > }; > if (T.0_3 > 0) goto ; else goto ; > # SUCC: 3 [21.0%] (false,exec) 2 [79.0%] (true,exec) > > # BLOCK 2 > # PRED: 1 [79.0%] (true,exec) > :; > T.1_9 = if (1 && T.0_3 > 0) why this "1 &&" part? > { > C[i_1]; > }; > T.2_10 = if (1 && T.0_3 > 0) > { > T.0_3 + T.1_9; > }; > A[i_1] = if (1 && T.0_3 > 0) > { > T.2_10 > }; > T.3_12 = if (1 && T.0_3 > 0) > { > T.2_10 + 1; > }; > B[i_1] = if (1 && T.0_3 > 0) > { > T.3_12 > }; > goto (); > # SUCC: 4 [100.0%] (fallthru,exec) > > # BLOCK 3 > # PRED: 1 [21.0%] (false,exec) > :; > T.4_5 = if (1 && !(T.0_3 > 0)) > { > D[i_1]; > }; > A[i_1] = if (1 && !(T.0_3 > 0)) > { > T.4_5 > }; > T.5_7 = if (1 && !(T.0_3 > 0)) > { > T.4_5 + 1; > }; > B[i_1] = if (1 && !(T.0_3 > 0)) > { > T.5_7 > }; > # SUCC: 4 [100.0%] (fallthru,exec) > > # BLOCK 4 > # PRED: 3 [100.0%] (fallthru,exec) 2 [100.0%] (fallthru,exec) > :; > i_15 = i_1 + 1; > if (i_15 <= 15) goto ; else goto ; > # SUCC: 5 [11.0%] (false,exec) 6 [89.0%] (true,exec) > > # BLOCK 6 > # PRED: 4 [89.0%] (true,exec) > :; > goto (); > # SUCC: 1 [100.0%] (fallthru) > > # BLOCK 5 > # PRED: 4 [11.0%] (false,exec) > :; > ibar (&A); > ibar (&B); > return; > # SUCC: EXIT [100.0%] > > } > > I spent lot of time unnecessary to create super block inside loop by > merging block 2 and 3 into block 1. > > If vectorizer can not vectorize this loop then it will be reverted to > original form using loop versioning. Am I on the right track ? I am not at all sure what you want to achieve with this transformation; it seems to me that you haven't done anything that could possibly make vectorizer's work easier. Zdenek