From: Richard Biener Date: Fri, 24 May 2019 08:48:14 +0000 (+0000) Subject: re PR tree-optimization/88440 (size optimization of memcpy-like code) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1d672917b4b324a6aac3743f21b8c58940a0ceb8;p=gcc.git re PR tree-optimization/88440 (size optimization of memcpy-like code) 2019-05-23 Richard Biener PR tree-optimization/88440 * opts.c (default_options_table): Enable -ftree-loop-distribute-patterns at -O[2s]+. * tree-loop-distribution.c (generate_memset_builtin): Fold the generated call. (generate_memcpy_builtin): Likewise. (distribute_loop): Pass in whether to only distribute patterns. (prepare_perfect_loop_nest): Also allow size optimization. (pass_loop_distribution::execute): When optimizing a loop nest for size allow pattern replacement. * gcc.dg/tree-ssa/ldist-37.c: New testcase. * gcc.dg/tree-ssa/ldist-38.c: Likewise. * gcc.dg/vect/vect.exp: Add -fno-tree-loop-distribute-patterns. * gcc.dg/tree-ssa/ldist-37.c: Adjust. * gcc.dg/tree-ssa/ldist-38.c: Likewise. * g++.dg/tree-ssa/pr78847.C: Likewise. * gcc.dg/autopar/pr39500-1.c: Likewise. * gcc.dg/autopar/reduc-1char.c: Likewise. * gcc.dg/autopar/reduc-7.c: Likewise. * gcc.dg/tree-ssa/ivopts-lt-2.c: Likewise. * gcc.dg/tree-ssa/ivopts-lt.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-1.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-2.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-3.c: Likewise. * gcc.dg/tree-ssa/predcom-dse-4.c: Likewise. * gcc.dg/tree-ssa/prefetch-7.c: Likewise. * gcc.dg/tree-ssa/prefetch-8.c: Likewise. * gcc.dg/tree-ssa/prefetch-9.c: Likewise. * gcc.dg/tree-ssa/scev-11.c: Likewise. * gcc.dg/vect/costmodel/i386/costmodel-vect-31.c: Likewise. * gcc.dg/vect/costmodel/i386/costmodel-vect-33.c: Likewise. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c: Likewise. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-33.c: Likewise. * gcc.target/i386/pr30970.c: Likewise. * gcc.target/i386/vect-double-1.c: Likewise. * gcc.target/i386/vect-double-2.c: Likewise. * gcc.dg/tree-ssa/gen-vect-2.c: Likewise. * gcc.dg/tree-ssa/gen-vect-26.c: Likewise. * gcc.dg/tree-ssa/gen-vect-28.c: Likewise. * gcc.dg/tree-ssa/gen-vect-32.c: Likewise. * gfortran.dg/vect/vect-5.f90: Likewise. * gfortran.dg/vect/vect-8.f90: Likewise. From-SVN: r271595 --- diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-37.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-37.c new file mode 100644 index 00000000000..9aae4328394 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-37.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -fdump-tree-ldist-optimized" } */ + +void foo(char* restrict dst, const char* buf) +{ + for (int i=0; i<8; ++i) + *dst++ = *buf++; +} + +/* { dg-final { scan-tree-dump "split to 0 loops and 1 library calls" "ldist" } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ldist-38.c b/gcc/testsuite/gcc.dg/tree-ssa/ldist-38.c new file mode 100644 index 00000000000..e296e829528 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/ldist-38.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-tree-ldist-optimized" } */ + +void foo(char* restrict dst, const char* buf) +{ + for (int i=0; i<8; ++i) + *dst++ = *buf++; +} + +/* { dg-final { scan-tree-dump "split to 0 loops and 1 library calls" "ldist" } } */