From 522d2ab6092a7df203cbef07e442060834e01617 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 5 Jun 2018 10:01:49 +0000 Subject: [PATCH] 2018-06-05 Richard Biener PR tree-optimization/86047 * tree-ssa-loop.c (for_each_index): Glob handling of all decls and constants and really handle all of them. * gcc.dg/pr86047.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261192 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr86047.c | 13 +++++++++++++ gcc/tree-ssa-loop.c | 14 +++----------- 4 files changed, 27 insertions(+), 11 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr86047.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1681b231e9b..f67d2bbb892 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-06-05 Richard Biener + + PR tree-optimization/86047 + * tree-ssa-loop.c (for_each_index): Glob handling of all + decls and constants and really handle all of them. + 2018-06-05 Kyrylo Tkachov PR target/81497 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 52282f6c8a9..1ad08c6e34c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-05 Richard Biener + + PR tree-optimization/86047 + * gcc.dg/pr86047.c: New testcase. + 2018-06-05 Kyrylo Tkachov PR target/81497 diff --git a/gcc/testsuite/gcc.dg/pr86047.c b/gcc/testsuite/gcc.dg/pr86047.c new file mode 100644 index 00000000000..6192d2d4a0d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr86047.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O2" } */ + +extern void f (int, int); +void g (int a, int b) +{ + int i, j; + for (i = a; i <= b; ++i) + __builtin_memcpy (g, f, 6); + for (j = a; j <= b; ++j) + f(j, i); +} + diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index 6c3e516d536..b2a7d18b601 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -610,17 +610,6 @@ for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data) return false; break; - case VAR_DECL: - case PARM_DECL: - case CONST_DECL: - case STRING_CST: - case RESULT_DECL: - case VECTOR_CST: - case COMPLEX_CST: - case INTEGER_CST: - case POLY_INT_CST: - case REAL_CST: - case FIXED_CST: case CONSTRUCTOR: return true; @@ -644,6 +633,9 @@ for_each_index (tree *addr_p, bool (*cbck) (tree, tree *, void *), void *data) return true; default: + if (DECL_P (*addr_p) + || CONSTANT_CLASS_P (*addr_p)) + return true; gcc_unreachable (); } } -- 2.11.4.GIT