This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[lno] copy header and vectorization
- From: Devang Patel <dpatel at apple dot com>
- To: "gcc at gcc dot gnu dot org list" <gcc at gcc dot gnu dot org>
- Date: Tue, 17 Feb 2004 20:15:26 -0800
- Subject: [lno] copy header and vectorization
Current lno-branch sources are not able to auto-vectorize simple loops.
I need to disable copy header phase on lno-branch to fix this.
-----------------
#define N 16
void foo (int n)
{
int a[N+1];
int i,j;
/* Vectorizable. */
for (i = 0; i < N; i++){
a[i] = i;
}
}
-----------------
After copy header phase, scev determines the initial condition for this
loop is i=1 and that causes vectorizer to reject this loop. I am
including
debug dump after copy header at the end of email.
Is it a known issue ?
--
Devang
;; Function foo (foo)
;; 3 loops found, 2 levels
;;
;; Loop 0:
;; header -1, latch -2, pre-header -1
;; depth 0, level 2, outer -1
;; nodes: -1 0 1 5 2 4 6 3 -2
;;
;; Loop 1:
;; header 1, latch 5, pre-header -1
;; depth 1, level 1, outer 0
;; nodes: 1 5
;;
;; Loop 2:
;; header 4, latch 6, pre-header -1
;; depth 1, level 1, outer 0
;; nodes: 4 6
;; 0 succs { 1 }
;; 1 succs { 2 5 }
;; 5 succs { 1 }
;; 2 succs { 4 }
;; 4 succs { 3 6 }
;; 6 succs { 4 }
;; 3 succs { -2 }
Removing basic block 5
Removing basic block 2
Removing basic block 6
Merging blocks 0 and 8
foo (n)
{
int j;
int i;
int a[17];
int T.1;
<bb 0>:
i_2 = 0;
a[i_2] = i_2;
i_15 = i_2 + 1;
if (i_15 <= 15) goto <L0>; else goto <L9>;
# i_1 = PHI <i_15(0), i_18(1)>;
<L0>:;
a[i_1] = i_1;
i_18 = i_1 + 1;
if (i_18 <= 15) goto <L0>; else goto <L9>;
<L9>:;
i_16 = 0;
# i_14 = PHI <i_16(2), i_17(3)>;
<L6>:;
T.1_5 = a[i_14];
printf ("%d\n", T.1_5);
i_17 = i_14 + 1;
if (i_17 <= 15) goto <L6>; else goto <L5>;
<L5>:;
return;
}
;; Function main (main)
main ()
{
<bb 0>:
foo (16);
return;
}