From: Marc Glisse Date: Fri, 3 May 2019 13:41:36 +0000 (+0200) Subject: Let ldist ignore clobbers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=051ef623d6e332a6199bbf4e6c66e53925cac825;p=gcc.git Let ldist ignore clobbers 2019-05-03 Marc Glisse PR tree-optimization/90269 gcc/ * tree-loop-distribution.c (find_seed_stmts_for_distribution): Ignore clobbers. gcc/testsuite/ * g++.dg/tree-ssa/ldist-1.C: New file. From-SVN: r270852 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ac134c60419..a1f23567ebc 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-05-03 Marc Glisse + + PR tree-optimization/90269 + * tree-loop-distribution.c (find_seed_stmts_for_distribution): + Ignore clobbers. + 2019-05-03 Martin Liska * hash-map.h: Add is_empty function. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7ae100f4fb2..7dbb8503981 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-03 Marc Glisse + + PR tree-optimization/90269 + * g++.dg/tree-ssa/ldist-1.C: New file. + 2019-05-03 Richard Biener * gcc.dg/vect/slp-reduc-sad-2.c: New testcase. diff --git a/gcc/testsuite/g++.dg/tree-ssa/ldist-1.C b/gcc/testsuite/g++.dg/tree-ssa/ldist-1.C new file mode 100644 index 00000000000..0fc6a61f0b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/ldist-1.C @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -fdump-tree-ldist-details" } */ + +#include +struct T { + int* p; + T(T const&t):p(t.p){} +}; +void f(T*__restrict a,T*__restrict b){ + for(int i=0;i<1024;++i){ + new(a+i)T(b[i]); + b[i].~T(); + } +} + +/* { dg-final { scan-tree-dump "generated memcpy" "ldist" } } */ diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c index 8959f52a67b..3d8f13c4d14 100644 --- a/gcc/tree-loop-distribution.c +++ b/gcc/tree-loop-distribution.c @@ -3040,6 +3040,10 @@ find_seed_stmts_for_distribution (struct loop *loop, vec *work_list) { gimple *stmt = gsi_stmt (gsi); + /* Ignore clobbers, they do not have true side effects. */ + if (gimple_clobber_p (stmt)) + continue; + /* If there is a stmt with side-effects bail out - we cannot and should not distribute this loop. */ if (gimple_has_side_effects (stmt))