Commit d0582dc1 by Richard Guenther Committed by Richard Biener

re PR tree-optimization/53081 (memcpy/memset loop recognition)

2012-06-06  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/53081
	* tree-data-ref.h (adjacent_store_dr_p): Rename to ...
	(adjacent_dr_p): ... this and make it work for reads, too.
	* tree-loop-distribution.c (enum partition_kind): Add PKIND_MEMCPY.
	(struct partition_s): Change main_stmt to main_dr, add
	secondary_dr member.
	(build_size_arg_loc): Change to date data-reference and not
	gimplify here.
	(build_addr_arg_loc): New function split out from ...
	(generate_memset_builtin): ... here.  Use it and simplify.
	(generate_memcpy_builtin): New function.
	(generate_code_for_partition): Adjust.
	(classify_partition): Streamline pattern detection.  Detect
	memcpy.
	(ldist_gen): Adjust.
	(tree_loop_distribution): Adjust seed statements for memcpy
	recognition.

	* gcc.dg/tree-ssa/ldist-20.c: New testcase.
	* gcc.dg/tree-ssa/loop-19.c: Add -fno-tree-loop-distribute-patterns.

From-SVN: r188261
parent 4ad4fa63
2012-06-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/53081
* tree-data-ref.h (adjacent_store_dr_p): Rename to ...
(adjacent_dr_p): ... this and make it work for reads, too.
* tree-loop-distribution.c (enum partition_kind): Add PKIND_MEMCPY.
(struct partition_s): Change main_stmt to main_dr, add
secondary_dr member.
(build_size_arg_loc): Change to date data-reference and not
gimplify here.
(build_addr_arg_loc): New function split out from ...
(generate_memset_builtin): ... here. Use it and simplify.
(generate_memcpy_builtin): New function.
(generate_code_for_partition): Adjust.
(classify_partition): Streamline pattern detection. Detect
memcpy.
(ldist_gen): Adjust.
(tree_loop_distribution): Adjust seed statements for memcpy
recognition.
2012-06-06 Matt Turner <mattst88@gmail.com>
* config/arm/mmintrin.h (_mm_empty): New.
......
2012-06-06 Richard Guenther <rguenther@suse.de>
PR tree-optimization/53081
* gcc.dg/tree-ssa/ldist-20.c: New testcase.
* gcc.dg/tree-ssa/loop-19.c: Add -fno-tree-loop-distribute-patterns.
2012-06-05 Michael Meissner <meissner@linux.vnet.ibm.com>
* gcc.target/powerpc/pr53487.c: New test.
......
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-distribute-patterns -fdump-tree-ldist-details" } */
void foo(char *);
void my_memcpy (void *q, unsigned int n)
{
unsigned i;
char p[1024];
for (i = 0; i < n; ++i)
((char *)p)[i] = ((char *)q)[i];
foo(p);
}
struct S { int i; int j; };
void my_memcpy2 (void *q, unsigned int n)
{
unsigned i;
char p[1024];
for (i = 0; i < n; ++i)
((struct S *)p)[i] = ((struct S *)q)[i];
foo(p);
}
char p[1024];
void my_memmove (unsigned int n)
{
unsigned i;
for (i = 0; i < n; ++i)
p[i] = p[i+1];
foo(p);
}
/* { dg-final { scan-tree-dump-times "generated memcpy" 2 "ldist" } } */
/* { dg-final { scan-tree-dump-times "generated memmove" 1 "ldist" } } */
/* { dg-final { cleanup-tree-dump "ldist" } } */
......@@ -6,7 +6,7 @@
/* { dg-do compile { target { i?86-*-* || { x86_64-*-* || powerpc_hard_double } } } } */
/* { dg-require-effective-target nonpic } */
/* { dg-options "-O3 -fno-prefetch-loop-arrays -fdump-tree-optimized" } */
/* { dg-options "-O3 -fno-tree-loop-distribute-patterns -fno-prefetch-loop-arrays -fdump-tree-optimized" } */
# define N 2000000
double a[N],c[N];
......
......@@ -615,11 +615,8 @@ bool rdg_defs_used_in_other_loops_p (struct graph *, int);
with a stride equal to its unit type size. */
static inline bool
adjacent_store_dr_p (struct data_reference *dr)
adjacent_dr_p (struct data_reference *dr)
{
if (!DR_IS_WRITE (dr))
return false;
/* If this is a bitfield store bail out. */
if (TREE_CODE (DR_REF (dr)) == COMPONENT_REF
&& DECL_BIT_FIELD (TREE_OPERAND (DR_REF (dr), 1)))
......
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