From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id 58E313949F32; Fri, 14 May 2021 14:55:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58E313949F32 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] tree-optimization/99954 - fix loop distribution memcpy classification X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/vendors/redhat/heads/gcc-8-branch X-Git-Oldrev: 66b2bd17afebe4ef82876c226cbf7aed91f3da83 X-Git-Newrev: 42f6f70f0a81257f715a96bb7f075d2485af4a1f Message-Id: <20210514145516.58E313949F32@sourceware.org> Date: Fri, 14 May 2021 14:55:16 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 May 2021 14:55:16 -0000 https://gcc.gnu.org/g:42f6f70f0a81257f715a96bb7f075d2485af4a1f commit 42f6f70f0a81257f715a96bb7f075d2485af4a1f Author: Richard Biener Date: Wed Apr 7 13:17:05 2021 +0200 tree-optimization/99954 - fix loop distribution memcpy classification This fixes bogus classification of a copy as memcpy. We cannot use plain dependence analysis to decide between memcpy and memmove when it computes no dependence. Instead we have to try harder later which the patch does for the gcc.dg/tree-ssa/ldist-24.c testcase by resorting to tree-affine to compute the difference between src and dest and compare against the copy size. 2021-04-07 Richard Biener PR tree-optimization/99954 * tree-loop-distribution.c: Include tree-affine.h. (generate_memcpy_builtin): Try using tree-affine to prove non-overlap. (loop_distribution::classify_builtin_ldst): Always classify as PKIND_MEMMOVE. * gcc.dg/torture/pr99954.c: New testcase. (cherry picked from commit b091cb1efa1881e93fb2e264daaab8876acf6800) Diff: --- gcc/testsuite/gcc.dg/torture/pr99954.c | 30 ++++++++++++++++++++++++++++++ gcc/tree-loop-distribution.c | 17 +++++++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/gcc/testsuite/gcc.dg/torture/pr99954.c b/gcc/testsuite/gcc.dg/torture/pr99954.c new file mode 100644 index 00000000000..7d447035912 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr99954.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ + +#include + +#define CONTAINER_KIND union + +typedef CONTAINER_KIND container { int value; } container; + +void move(container* end, container* start) { + container* p; + for (p = end; p > start; p--) { + (p)->value = (p-1)->value; + } +} + +#define N 100 + +int main(int argc, char* argv[]) { + container vals[N]; + int i; + for (i=0; ibuiltin = alloc_builtin (dst_dr, src_dr, base, src_base, size); - partition->kind = PKIND_MEMCPY; + partition->kind = PKIND_MEMMOVE; return; }