From 0a28fdcaf70aee998705bf5878f4c508d9641e31 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 24 Sep 2015 07:34:47 +0000 Subject: [PATCH] re PR c/48885 (missed optimization with restrict qualifier?) 2015-09-24 Richard Biener PR tree-optimization/48885 * tree-ssa-structalias.c (visit_loadstore): Handle default defs as not including any restrict tags from other pointers. * gcc.dg/tree-ssa/restrict-6.c: New testcase. From-SVN: r228073 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/restrict-6.c | 11 +++++++++++ gcc/tree-ssa-structalias.c | 5 +++-- 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/restrict-6.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9eb9afd30c..5ae3e4436af 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-09-24 Richard Biener + + PR tree-optimization/48885 + * tree-ssa-structalias.c (visit_loadstore): Handle default defs + as not including any restrict tags from other pointers. + 2015-09-23 Thomas Schwinge * gcc.c (handle_foffload_option): Don't lose the trailing NUL diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf0e13a0cef..1d9b87273e9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-09-24 Richard Biener + + PR tree-optimization/48885 + * gcc.dg/tree-ssa/restrict-6.c: New testcase. + 2015-09-24 Patrick Palka * c-c++-common/Wmisleading-indentation.c: Augment test. diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-6.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-6.c new file mode 100644 index 00000000000..7c5ed0119cb --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/restrict-6.c @@ -0,0 +1,11 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fdump-tree-fre1" } */ + +void +test (int *a, int *b, int * __restrict__ v) +{ + *a = *v; + *b = *v; +} + +/* { dg-final { scan-tree-dump-times "= \\*v" 1 "fre1" } } */ diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 8d81bd4f730..8d86dcbf0cc 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -6952,10 +6952,11 @@ visit_loadstore (gimple *, tree base, tree ref, void *clique_) || TREE_CODE (base) == TARGET_MEM_REF) { tree ptr = TREE_OPERAND (base, 0); - if (TREE_CODE (ptr) == SSA_NAME) + if (TREE_CODE (ptr) == SSA_NAME + && ! SSA_NAME_IS_DEFAULT_DEF (ptr)) { /* ??? We need to make sure 'ptr' doesn't include any of - the restrict tags in its points-to set. */ + the restrict tags we added bases for in its points-to set. */ return false; } -- 2.30.2