From be6e26f995d137d8608d6c93c65316b6c3d2617d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 23 Sep 2015 11:11:48 +0000 Subject: [PATCH] tree-ssa-structalias.c (intra_create_variable_infos): Build representatives for all restrict qualified pointer destinations. 2015-09-23 Richard Biener * tree-ssa-structalias.c (intra_create_variable_infos): Build representatives for all restrict qualified pointer destinations. * g++.dg/tree-ssa/restrict2.C: Un-XFAIL testcase. From-SVN: r228040 --- gcc/ChangeLog | 5 +++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/tree-ssa/restrict2.C | 3 +-- gcc/tree-ssa-structalias.c | 12 ++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0cc98c7febd..c46bd6d26a7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-09-23 Richard Biener + + * tree-ssa-structalias.c (intra_create_variable_infos): Build + representatives for all restrict qualified pointer destinations. + 2015-09-23 Kirill Yukhin * config/i386/i386.md (define_code_attr mshift): New. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 404b84cb0d6..36e30b6056e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-09-23 Richard Biener + + * g++.dg/tree-ssa/restrict2.C: Un-XFAIL testcase. + 2015-09-22 Patrick Palka * c-c++-common/Wmisleading-indentation.c: Augment test. diff --git a/gcc/testsuite/g++.dg/tree-ssa/restrict2.C b/gcc/testsuite/g++.dg/tree-ssa/restrict2.C index e2be0df12e5..4f97360dc72 100644 --- a/gcc/testsuite/g++.dg/tree-ssa/restrict2.C +++ b/gcc/testsuite/g++.dg/tree-ssa/restrict2.C @@ -45,8 +45,7 @@ f5 (S *__restrict x, S *__restrict y) { x->p[0] = 5; y->p[0] = 0; -// We might handle this some day -// { dg-final { scan-tree-dump-times "return 5" 1 "optimized" { xfail *-*-* } } } +// { dg-final { scan-tree-dump-times "return 5" 1 "optimized" } } return x->p[0]; } diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 1767b0435d7..8d81bd4f730 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5857,12 +5857,12 @@ intra_create_variable_infos (struct function *fn) { varinfo_t p = get_vi_for_tree (t); - /* For restrict qualified pointers to objects passed by - reference build a real representative for the pointed-to object. - Treat restrict qualified references the same. */ - if (TYPE_RESTRICT (TREE_TYPE (t)) - && ((DECL_BY_REFERENCE (t) && POINTER_TYPE_P (TREE_TYPE (t))) - || TREE_CODE (TREE_TYPE (t)) == REFERENCE_TYPE) + /* For restrict qualified pointers build a representative for + the pointed-to object. Note that this ends up handling + out-of-bound references conservatively by aggregating them + in the first/last subfield of the object. */ + if (POINTER_TYPE_P (TREE_TYPE (t)) + && TYPE_RESTRICT (TREE_TYPE (t)) && !type_contains_placeholder_p (TREE_TYPE (TREE_TYPE (t)))) { struct constraint_expr lhsc, rhsc; -- 2.30.2