public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ibm/heads/perf)] PR tree-optimization/92128 - fold more non-constant strlen relational expressions
@ 2020-03-19  5:43 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-03-19  5:43 UTC (permalink / raw)
  To: gcc-cvs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="us-ascii", Size: 2382 bytes --]

https://gcc.gnu.org/g:ccf86d54cb02ed24bc4568bd9fffdcdbf0bf68a8

commit ccf86d54cb02ed24bc4568bd9fffdcdbf0bf68a8
Author: Martin Sebor <msebor@redhat.com>
Date:   Wed Feb 19 16:54:50 2020 -0700

    PR tree-optimization/92128 - fold more non-constant strlen relational expressions
    
    gcc/testsuite/ChangeLog:
            * gcc.dg/strlenopt-81.c: Align arrays to let strictly aligned targets
            optimize away calls as expected.

Diff:
---
 gcc/testsuite/ChangeLog             |  6 ++++++
 gcc/testsuite/gcc.dg/strlenopt-81.c | 13 +++++++++----
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ec3c34a2a30..049c343fe43 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2020-02-19  Martin Sebor  <msebor@redhat.com>
+
+	PR tree-optimization/92128
+	* gcc.dg/strlenopt-81.c: Align arrays to let strictly aligned targets
+	optimize away calls as expected.
+
 2020-02-19  Uroš Bizjak  <ubizjak@gmail.com>
 
 	* gcc.dg/gimplefe-41.c: Add -msse2 additional options for x86 targets.
diff --git a/gcc/testsuite/gcc.dg/strlenopt-81.c b/gcc/testsuite/gcc.dg/strlenopt-81.c
index 95ac29aa71f..f493514cfcc 100644
--- a/gcc/testsuite/gcc.dg/strlenopt-81.c
+++ b/gcc/testsuite/gcc.dg/strlenopt-81.c
@@ -1,6 +1,6 @@
-/* PR tree-optimization/ - fold strlen relational expressions
+/* PR tree-optimization/91996 - fold non-constant strlen relational expressions
    { dg-do run }
-   { dg-options "-O2 -Wall -Wno-unused-local-typedefs -fdump-tree-optimized" } */
+   { dg-options "-O2 -Wall -Wno-unused-local-typedefs" } */
 
 typedef __SIZE_TYPE__ size_t;
 
@@ -17,7 +17,10 @@ typedef __SIZE_TYPE__ size_t;
     CAT (CAT (test_on_line_, __LINE__), _not_eliminated)();		\
   } typedef void dummy_type
 
-char a[32], b[32];
+
+/* Set the alignment for targets that depend on it in order to
+   optimize away the ELIM calls.  See pr92128.  */
+__attribute__ ((aligned(4))) char a[32], b[32];
 
 void init (void)
 {
@@ -89,7 +92,9 @@ NOIPA void test_local_cpy_4 (void)
   size_t blen = __builtin_strlen (b);
   if (blen < 9) return;
 
-  char a[10] = "abcdefgh";
+/* Set the alignment for targets that depend on it in order to
+   optimize away the ELIM calls.  See pr92128.  */
+  __attribute__ ((aligned(4))) char a[10] = "abcdefgh";
   char *d = a;
   __builtin_memcpy (d, b, 4);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-19  5:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19  5:43 [gcc(refs/vendors/ibm/heads/perf)] PR tree-optimization/92128 - fold more non-constant strlen relational expressions Jiu Fu Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).