Commit ccf86d54 by Martin Sebor

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.
parent 38c7b74d
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> 2020-02-19 Uroš Bizjak <ubizjak@gmail.com>
* gcc.dg/gimplefe-41.c: Add -msse2 additional options for x86 targets. * gcc.dg/gimplefe-41.c: Add -msse2 additional options for x86 targets.
......
/* PR tree-optimization/ - fold strlen relational expressions /* PR tree-optimization/91996 - fold non-constant strlen relational expressions
{ dg-do run } { 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; typedef __SIZE_TYPE__ size_t;
...@@ -17,7 +17,10 @@ typedef __SIZE_TYPE__ size_t; ...@@ -17,7 +17,10 @@ typedef __SIZE_TYPE__ size_t;
CAT (CAT (test_on_line_, __LINE__), _not_eliminated)(); \ CAT (CAT (test_on_line_, __LINE__), _not_eliminated)(); \
} typedef void dummy_type } 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) void init (void)
{ {
...@@ -89,7 +92,9 @@ NOIPA void test_local_cpy_4 (void) ...@@ -89,7 +92,9 @@ NOIPA void test_local_cpy_4 (void)
size_t blen = __builtin_strlen (b); size_t blen = __builtin_strlen (b);
if (blen < 9) return; 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; char *d = a;
__builtin_memcpy (d, b, 4); __builtin_memcpy (d, b, 4);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment