Commit 806bdf4e by Richard Biener Committed by Richard Biener

re PR tree-optimization/91975 (worse code for small array copy using pointer…

re PR tree-optimization/91975 (worse code for small array copy using pointer arithmetic than array indexing)

2019-10-07  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/91975
	* tree-ssa-loop-ivcanon.c (constant_after_peeling): Consistently
	handle invariants.

	* g++.dg/tree-ssa/ivopts-3.C: Adjust.
	* gcc.dg/vect/vect-profile-1.c: Disable cunrolli.
	* gcc.dg/vect/vect-double-reduc-6.c: Disable unrolling of
	the innermost loop.
	* gcc.dg/vect/vect-93.c: Likewise.
	* gcc.dg/vect/vect-105.c: Likewise.
	* gcc.dg/vect/pr79920.c: Likewise.
	* gcc.dg/vect/no-vfa-vect-102.c: Likewise.
	* gcc.dg/vect/no-vfa-vect-101.c: Likewise.
	* gcc.dg/vect/pr83202-1.c: Operate on a larger array.
	* gfortran.dg/vect/vect-8.f90: Likewise.
	* gcc.dg/tree-ssa/cunroll-2.c: Scan early unrolling dump instead
	of late one.

From-SVN: r276645
parent 3e1f7c33
2019-10-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/91975
* tree-ssa-loop-ivcanon.c (constant_after_peeling): Consistently
handle invariants.
2019-10-06 Richard Sandiford <richard.sandiford@arm.com> 2019-10-06 Richard Sandiford <richard.sandiford@arm.com>
* var-tracking.c (dataflow_set_clear_at_call): Hoist temporary * var-tracking.c (dataflow_set_clear_at_call): Hoist temporary
......
2019-10-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/91975
* g++.dg/tree-ssa/ivopts-3.C: Adjust.
* gcc.dg/vect/vect-profile-1.c: Disable cunrolli.
* gcc.dg/vect/vect-double-reduc-6.c: Disable unrolling of
the innermost loop.
* gcc.dg/vect/vect-93.c: Likewise.
* gcc.dg/vect/vect-105.c: Likewise.
* gcc.dg/vect/pr79920.c: Likewise.
* gcc.dg/vect/no-vfa-vect-102.c: Likewise.
* gcc.dg/vect/no-vfa-vect-101.c: Likewise.
* gcc.dg/vect/pr83202-1.c: Operate on a larger array.
* gfortran.dg/vect/vect-8.f90: Likewise.
* gcc.dg/tree-ssa/cunroll-2.c: Scan early unrolling dump instead
of late one.
2019-10-05 Steven G. Kargl <kargl@gcc.gnu.org> 2019-10-05 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/47045 PR fortran/47045
......
...@@ -70,6 +70,8 @@ int main ( int , char** ) { ...@@ -70,6 +70,8 @@ int main ( int , char** ) {
return 0; return 0;
} }
// Verify that on x86_64 and i?86 we use a single IV for the innermost loop // Verify that on x86_64 and i?86 we unroll the innsermost loop and
// use three IVs for the then innermost loop
// { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:64, 3 avg niters, 1 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } } // { dg-final { scan-tree-dump "Selected IV set for loop \[0-9\]* at \[^ \]*:63, 127 avg niters, 3 IVs" "ivopts" { target x86_64-*-* i?86-*-* } } }
// { dg-final { scan-tree-dump-not "Selected IV set for loop \[0-9\]* at \[^ \]*:64" "ivopts" { target x86_64-*-* i?86-*-* } } }
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-cunroll-details" } */ /* { dg-options "-O3 -fdump-tree-cunrolli-details" } */
int a[2]; int a[2];
int test2 (void); int test2 (void);
void void
...@@ -14,4 +14,4 @@ test(int c) ...@@ -14,4 +14,4 @@ test(int c)
} }
} }
/* We are not able to get rid of the final conditional because the loop has two exits. */ /* We are not able to get rid of the final conditional because the loop has two exits. */
/* { dg-final { scan-tree-dump "loop with 1 iterations completely unrolled" "cunroll"} } */ /* { dg-final { scan-tree-dump "loop with 2 iterations completely unrolled" "cunrolli"} } */
...@@ -22,6 +22,7 @@ int main1 (int x, int y) { ...@@ -22,6 +22,7 @@ int main1 (int x, int y) {
p = (struct extraction *) malloc (sizeof (struct extraction)); p = (struct extraction *) malloc (sizeof (struct extraction));
/* Not vectorizable: different unknown offset. */ /* Not vectorizable: different unknown offset. */
#pragma GCC unroll 0
for (i = 0; i < N; i++) for (i = 0; i < N; i++)
{ {
*((int *)p + x + i) = a[i]; *((int *)p + x + i) = a[i];
......
...@@ -28,6 +28,7 @@ int main1 (int x, int y) { ...@@ -28,6 +28,7 @@ int main1 (int x, int y) {
} }
/* Not vectorizable: distance 1. */ /* Not vectorizable: distance 1. */
#pragma GCC unroll 0
for (i = 0; i < N - 1; i++) for (i = 0; i < N - 1; i++)
{ {
*((int *)p + x + i + 1) = *((int *)p + x + i); *((int *)p + x + i + 1) = *((int *)p + x + i);
......
...@@ -14,6 +14,7 @@ compute_integral (double w_1[18]) ...@@ -14,6 +14,7 @@ compute_integral (double w_1[18])
for (int ip_1 = 0; ip_1 < 2; ++ip_1) for (int ip_1 = 0; ip_1 < 2; ++ip_1)
{ {
#pragma GCC unroll 0
for (int i_0 = 0; i_0 < 6; ++i_0) for (int i_0 = 0; i_0 < 6; ++i_0)
t33[ip_1][i_0] = ((w_1[i_0*3] * t32[ip_1][0]) t33[ip_1][i_0] = ((w_1[i_0*3] * t32[ip_1][0])
+ (w_1[i_0*3+2] * t32[ip_1][2])); + (w_1[i_0*3+2] * t32[ip_1][2]));
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target vect_double } */ /* { dg-require-effective-target vect_double } */
void test(double data[8][8]) void test(double data[16][16])
{ {
for (int i = 0; i < 8; i++) for (int i = 0; i < 16; i++)
{ {
for (int j = 0; j < i; j+=4) for (int j = 0; j < i; j+=4)
{ {
......
...@@ -35,6 +35,7 @@ int main1 (int x) { ...@@ -35,6 +35,7 @@ int main1 (int x) {
/* Vectorizable: distance > number of iterations. */ /* Vectorizable: distance > number of iterations. */
for (i = 1; i < N; i++) for (i = 1; i < N; i++)
{ {
#pragma GCC unroll 0
for (j = 0; j < N; j++) for (j = 0; j < N; j++)
{ {
*((int *)p + x + i + j) = *((int *)p + x + i + j + 5); *((int *)p + x + i + j) = *((int *)p + x + i + j + 5);
......
...@@ -29,6 +29,7 @@ main1 (float *pa) ...@@ -29,6 +29,7 @@ main1 (float *pa)
abort (); abort ();
} }
#pragma GCC unroll 0
for (i = 1; i <= N2; i++) for (i = 1; i <= N2; i++)
{ {
pa[i] = 3.0; pa[i] = 3.0;
......
...@@ -19,6 +19,7 @@ foo () ...@@ -19,6 +19,7 @@ foo ()
{ {
sum = 1; sum = 1;
for (j = 0; j < K; j++) for (j = 0; j < K; j++)
#pragma GCC unroll 0
for (i = 0; i < K; i++) for (i = 0; i < K; i++)
sum *= in[i+k][j]; sum *= in[i+k][j];
out[k] = sum; out[k] = sum;
......
/* { dg-do compile } */ /* { dg-do compile } */
/* { dg-require-effective-target vect_int } */ /* { dg-require-effective-target vect_int } */
/* { dg-additional-options "-fdump-tree-vect-details-blocks" } */ /* { dg-additional-options "-fdump-tree-vect-details-blocks -fdisable-tree-cunrolli" } */
/* At least one of these should correspond to a full vector. */ /* At least one of these should correspond to a full vector. */
......
...@@ -247,7 +247,7 @@ nl1= 1 ...@@ -247,7 +247,7 @@ nl1= 1
nl2= 2 nl2= 2
fw= 2.000D0 fw= 2.000D0
DO ky= 2,n DO ky= 2,n
DO kx= 2,3 DO kx= 2,4
du1ky= u1(kx,ky+1,nl1)-u1(kx,ky-1,nl1) du1ky= u1(kx,ky+1,nl1)-u1(kx,ky-1,nl1)
du2ky= u2(kx,ky+1,nl1)-u2(kx,ky-1,nl1) du2ky= u2(kx,ky+1,nl1)-u2(kx,ky-1,nl1)
du3ky= u3(kx,ky+1,nl1)-u3(kx,ky-1,nl1) du3ky= u3(kx,ky+1,nl1)-u3(kx,ky-1,nl1)
......
...@@ -195,9 +195,8 @@ constant_after_peeling (tree op, gimple *stmt, class loop *loop) ...@@ -195,9 +195,8 @@ constant_after_peeling (tree op, gimple *stmt, class loop *loop)
/* Induction variables are constants when defined in loop. */ /* Induction variables are constants when defined in loop. */
if (loop_containing_stmt (stmt) != loop) if (loop_containing_stmt (stmt) != loop)
return false; return false;
tree ev = analyze_scalar_evolution (loop, op); tree ev = instantiate_parameters (loop, analyze_scalar_evolution (loop, op));
if (chrec_contains_undetermined (ev) if (chrec_contains_undetermined (ev))
|| chrec_contains_symbols (ev))
return false; return false;
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment