This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [lno] [RFC] if-conversion and auto vectorizer
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: Devang Patel <dpatel at apple dot com>
- Cc: "gcc at gcc dot gnu dot org list" <gcc at gcc dot gnu dot org>,Jason Merrill <jason at redhat dot com>, Dorit Naishlos <DORIT at il dot ibm dot com>,Richard Henderson <rth at redhat dot com>,Diego Novillo <dnovillo at redhat dot com>
- Date: Sat, 13 Mar 2004 10:24:38 +0100
- Subject: Re: [lno] [RFC] if-conversion and auto vectorizer
- References: <415253BF-7455-11D8-A347-000393A91CAA@apple.com>
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<N; 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)>;
> <L0>:;
> T.0_3 = if (1)
> {
> A[i_1];
> };
> if (T.0_3 > 0) goto <L1>; else goto <L2>;
> # SUCC: 3 [21.0%] (false,exec) 2 [79.0%] (true,exec)
>
> # BLOCK 2
> # PRED: 1 [79.0%] (true,exec)
> <L1>:;
> 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 <bb 4> (<L3>);
> # SUCC: 4 [100.0%] (fallthru,exec)
>
> # BLOCK 3
> # PRED: 1 [21.0%] (false,exec)
> <L2>:;
> 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)
> <L3>:;
> i_15 = i_1 + 1;
> if (i_15 <= 15) goto <L8>; else goto <L5>;
> # SUCC: 5 [11.0%] (false,exec) 6 [89.0%] (true,exec)
>
> # BLOCK 6
> # PRED: 4 [89.0%] (true,exec)
> <L8>:;
> goto <bb 1> (<L0>);
> # SUCC: 1 [100.0%] (fallthru)
>
> # BLOCK 5
> # PRED: 4 [11.0%] (false,exec)
> <L5>:;
> 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