diff options
author | Martin Liska <mliska@suse.cz> | 2018-08-01 12:21:49 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-08-01 10:21:49 +0000 |
commit | 181f2e99d142db78be636becfe6966fdbef61cb8 (patch) | |
tree | 0d354dc225c4450a7c650abe655f83e23517f035 | |
parent | 00d29b97d9ed9af957f896b8279ae85d2e16deb4 (diff) | |
download | gcc-181f2e99d142db78be636becfe6966fdbef61cb8.zip gcc-181f2e99d142db78be636becfe6966fdbef61cb8.tar.gz gcc-181f2e99d142db78be636becfe6966fdbef61cb8.tar.bz2 |
Add memmove to value profiling.
2018-08-01 Martin Liska <mliska@suse.cz>
PR value-prof/35543
* value-prof.c (interesting_stringop_to_profile_p):
Simplify the code and add BUILT_IN_MEMMOVE.
(gimple_stringops_transform): Likewise.
2018-08-01 Martin Liska <mliska@suse.cz>
PR value-prof/35543
* gcc.dg/tree-prof/val-prof-7.c: Add __builtin_memmove.
From-SVN: r263201
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c | 10 | ||||
-rw-r--r-- | gcc/value-prof.c | 8 |
4 files changed, 25 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b8152e3..a4cb451 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-08-01 Martin Liska <mliska@suse.cz> + + PR value-prof/35543 + * value-prof.c (interesting_stringop_to_profile_p): + Simplify the code and add BUILT_IN_MEMMOVE. + (gimple_stringops_transform): Likewise. + 2018-08-01 Sam Tebbs <sam.tebbs@arm.com> * config/aarch64/aarch64-simd.md diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f9448b9..00af769 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-08-01 Martin Liska <mliska@suse.cz> + + PR value-prof/35543 + * gcc.dg/tree-prof/val-prof-7.c: Add __builtin_memmove. + 2018-08-01 Sam Tebbs <sam.tebbs@arm.com> * gcc.target/aarch64/extract_zero_extend.c: New file. diff --git a/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c b/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c index c9303e0..bb9dd21 100644 --- a/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c +++ b/gcc/testsuite/gcc.dg/tree-prof/val-prof-7.c @@ -24,12 +24,18 @@ void memset_test_ ## N (int len) \ { \ __builtin_memset (buffer1, 'c', len); \ } \ +__attribute__((noinline)) \ +void memmove_test_ ## N (int len) \ +{ \ + __builtin_memmove (buffer1, buffer2, len); \ +} \ \ void test_stringops_ ## N(int len) \ { \ memcpy_test_## N (len); \ mempcpy_test_ ## N (len); \ memset_test_ ## N (len); \ + memmove_test_ ## N (len); \ } \ \ void test_stringops_with_values_ ## N (int common, int not_common) \ @@ -70,3 +76,7 @@ int main() { /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 8 stringop transformation on __builtin_memset" "profile" } } */ /* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 55 stringop transformation on __builtin_memset" "profile" } } */ /* { dg-final-use-not-autofdo { scan-ipa-dump-times "Single value 32 stringop transformation on __builtin_memset" 0 "profile" } } */ + +/* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 8 stringop transformation on __builtin_memmove" "profile" } } */ +/* { dg-final-use-not-autofdo { scan-ipa-dump "Single value 55 stringop transformation on __builtin_memmove" "profile" } } */ +/* { dg-final-use-not-autofdo { scan-ipa-dump-times "Single value 32 stringop transformation on __builtin_memmove" 0 "profile" } } */ diff --git a/gcc/value-prof.c b/gcc/value-prof.c index 77d4849..a7c4be7 100644 --- a/gcc/value-prof.c +++ b/gcc/value-prof.c @@ -1527,14 +1527,11 @@ interesting_stringop_to_profile_p (gcall *call, int *size_arg) enum built_in_function fcode; fcode = DECL_FUNCTION_CODE (gimple_call_fndecl (call)); - if (fcode != BUILT_IN_MEMCPY && fcode != BUILT_IN_MEMPCPY - && fcode != BUILT_IN_MEMSET && fcode != BUILT_IN_BZERO) - return false; - switch (fcode) { case BUILT_IN_MEMCPY: case BUILT_IN_MEMPCPY: + case BUILT_IN_MEMMOVE: *size_arg = 2; return validate_gimple_arglist (call, POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE); @@ -1547,7 +1544,7 @@ interesting_stringop_to_profile_p (gcall *call, int *size_arg) return validate_gimple_arglist (call, POINTER_TYPE, INTEGER_TYPE, VOID_TYPE); default: - gcc_unreachable (); + return false; } } @@ -1710,6 +1707,7 @@ gimple_stringops_transform (gimple_stmt_iterator *gsi) { case BUILT_IN_MEMCPY: case BUILT_IN_MEMPCPY: + case BUILT_IN_MEMMOVE: src = gimple_call_arg (stmt, 1); src_align = get_pointer_alignment (src); if (!can_move_by_pieces (val, MIN (dest_align, src_align))) |