On 2/13/20 8:34 PM, Kito Cheng wrote:
  - strlenopt-81.c has same limitation as strlenopt-80.c, this
    optimization only work when memcpy expand into load/store.

Unlike strlenopt-80.c which is a compile-time test that verifies
that the optimization successfully folds the strlen expressions,
strlenopt-81.c is a runtime test that verifies the optimization
isn't done when it might not be safe.   It shouldn't fail anywhere,
whether or not the optimization is actually done.  Are you seeing
it fail on some targets?  (That would suggest a bug.)

The test does look like it has a minor issue though: it uses
-fdump-tree-optimized but it doesn't actually scan the output for
anything.  I think it was copied from another test and not removed
by accident.  It should be removed.  (The comment at the top is
also missing the bug number that it was committed for; it should
be added.)  I can take care of this if you can confirm the above
(i.e., that there's no runtime failure on any of the targets
excluded in your patch).

Martin


ChangeLog

gcc/testsuite

Kito Cheng  <kito.ch...@sifive.com>

        * gcc.dg/strlenopt-81.c: Add target limitation.
---
  gcc/testsuite/gcc.dg/strlenopt-81.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gcc.dg/strlenopt-81.c 
b/gcc/testsuite/gcc.dg/strlenopt-81.c
index 95ac29aa71f..4a0dfc4f17d 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-81.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-81.c
@@ -1,5 +1,9 @@
  /* PR tree-optimization/ - fold strlen relational expressions
-   { dg-do run }
+   { dg-do run { target aarch64*-*-* i?86-*-* powerpc*-*-* x86_64-*-* } }
+   The optimization is only implemented for MEM_REF stores and other
+   targets than those below may not transform the memcpy call into
+   such a store.
+
     { dg-options "-O2 -Wall -Wno-unused-local-typedefs -fdump-tree-optimized" 
} */
typedef __SIZE_TYPE__ size_t;


Reply via email to