Commit 510d73a0 by Richard Biener Committed by Richard Biener

re PR tree-optimization/78348 ([7 REGRESSION] 15% performance drop for…

re PR tree-optimization/78348 ([7 REGRESSION] 15% performance drop for coremark-pro/nnet-test after r242038)

2016-11-16  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78348
	* tree-loop-distribution.c (enum partition_kind): Add PKIND_MEMMOVE.
	(generate_memcpy_builtin): Honor PKIND_MEMCPY on the partition.
	(classify_partition): Set PKIND_MEMCPY if dependence analysis
	revealed no dependency, PKIND_MEMMOVE otherwise.

	* gcc.dg/tree-ssa/ldist-24.c: New testcase.

From-SVN: r242470
parent 1705cebd
2016-11-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/78348
* tree-loop-distribution.c (enum partition_kind): Add PKIND_MEMMOVE.
(generate_memcpy_builtin): Honor PKIND_MEMCPY on the partition.
(classify_partition): Set PKIND_MEMCPY if dependence analysis
revealed no dependency, PKIND_MEMMOVE otherwise.
2016-11-16 Jakub Jelinek <jakub@redhat.com> 2016-11-16 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/77823 PR sanitizer/77823
2016-11-16 Richard Biener <rguenther@suse.de>
PR tree-optimization/78348
* gcc.dg/tree-ssa/ldist-24.c: New testcase.
2016-11-16 Jakub Jelinek <jakub@redhat.com> 2016-11-16 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/77823 PR sanitizer/77823
......
/* { dg-do compile } */
/* { dg-options "-O3 -fdump-tree-ldist-details" } */
typedef struct S {
double z[8][25];
double x1[8][40];
double x2[8][40];
double y[8][35];
} S;
S * par;
void foo ()
{
int i, j;
for (i = 0; i<8; i++)
for (j = 0; j<35; j++)
{
par->x1[i][j] = par->x2[i][j];
par->x2[i][j] = 0.0;
}
}
/* { dg-final { scan-tree-dump "generated memcpy" "ldist" } } */
/* { dg-final { scan-tree-dump "generated memset zero" "ldist" } } */
...@@ -466,7 +466,7 @@ build_rdg (vec<loop_p> loop_nest, control_dependences *cd) ...@@ -466,7 +466,7 @@ build_rdg (vec<loop_p> loop_nest, control_dependences *cd)
enum partition_kind { enum partition_kind {
PKIND_NORMAL, PKIND_MEMSET, PKIND_MEMCPY PKIND_NORMAL, PKIND_MEMSET, PKIND_MEMCPY, PKIND_MEMMOVE
}; };
struct partition struct partition
...@@ -875,10 +875,11 @@ generate_memcpy_builtin (struct loop *loop, partition *partition) ...@@ -875,10 +875,11 @@ generate_memcpy_builtin (struct loop *loop, partition *partition)
false, GSI_CONTINUE_LINKING); false, GSI_CONTINUE_LINKING);
dest = build_addr_arg_loc (loc, partition->main_dr, nb_bytes); dest = build_addr_arg_loc (loc, partition->main_dr, nb_bytes);
src = build_addr_arg_loc (loc, partition->secondary_dr, nb_bytes); src = build_addr_arg_loc (loc, partition->secondary_dr, nb_bytes);
if (ptr_derefs_may_alias_p (dest, src)) if (partition->kind == PKIND_MEMCPY
kind = BUILT_IN_MEMMOVE; || ! ptr_derefs_may_alias_p (dest, src))
else
kind = BUILT_IN_MEMCPY; kind = BUILT_IN_MEMCPY;
else
kind = BUILT_IN_MEMMOVE;
dest = force_gimple_operand_gsi (&gsi, dest, true, NULL_TREE, dest = force_gimple_operand_gsi (&gsi, dest, true, NULL_TREE,
false, GSI_CONTINUE_LINKING); false, GSI_CONTINUE_LINKING);
...@@ -970,6 +971,7 @@ generate_code_for_partition (struct loop *loop, ...@@ -970,6 +971,7 @@ generate_code_for_partition (struct loop *loop,
break; break;
case PKIND_MEMCPY: case PKIND_MEMCPY:
case PKIND_MEMMOVE:
generate_memcpy_builtin (loop, partition); generate_memcpy_builtin (loop, partition);
break; break;
...@@ -1166,10 +1168,12 @@ classify_partition (loop_p loop, struct graph *rdg, partition *partition) ...@@ -1166,10 +1168,12 @@ classify_partition (loop_p loop, struct graph *rdg, partition *partition)
return; return;
} }
} }
partition->kind = PKIND_MEMMOVE;
} }
else
partition->kind = PKIND_MEMCPY;
free_dependence_relation (ddr); free_dependence_relation (ddr);
loops.release (); loops.release ();
partition->kind = PKIND_MEMCPY;
partition->main_dr = single_store; partition->main_dr = single_store;
partition->secondary_dr = single_load; partition->secondary_dr = single_load;
partition->niter = nb_iter; partition->niter = nb_iter;
......
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