On 27/10/15 13:24, Tom de Vries wrote:
Thinking it over a bit more, I realized the constraint handling started
to be messy. I've reworked the patch series to simplify that first.
1 Simplify constraint handling
2 Rename make_restrict_var_constraints to make_param_constraints
3 Add recursion to make_param_constraints
4 Add handle_param parameter to create_variable_info_for_1
5 Handle recursive restrict pointer in create_variable_info_for_1
6 Handle restrict struct fields recursively
Currently doing bootstrap and regtest on x86_64.
I'll repost the patch series in reply to this message.
A repost of the patch at
https://gcc.gnu.org/ml/gcc-patches/2015-10/msg02779.html .
With the constraint handling dealt with earlier, it has become rather
minimal.
Thanks,
- Tom
Handle recursive restrict pointer in create_variable_info_for_1
2015-10-26 Tom de Vries <t...@codesourcery.com>
* tree-ssa-structalias.c (create_variable_info_for_1): Enable recursive
handling of restrict pointers.
* gcc.dg/tree-ssa/restrict-7.c: New test.
---
gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c | 12 ++++++++++++
gcc/tree-ssa-structalias.c | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c b/gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c
new file mode 100644
index 0000000..f7a68c7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/restrict-7.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fdump-tree-fre1" } */
+
+int
+f (int *__restrict__ *__restrict__ *__restrict__ a, int *b)
+{
+ *b = 1;
+ ***a = 2;
+ return *b;
+}
+
+/* { dg-final { scan-tree-dump-times "return 1" 1 "fre1" } } */
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index a639944..a297a36 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -5728,7 +5728,7 @@ create_variable_info_for_1 (tree decl, const char *name, bool handle_param)
varinfo_t rvi;
tree heapvar = build_fake_var_decl (TREE_TYPE (decl_type));
DECL_EXTERNAL (heapvar) = 1;
- rvi = create_variable_info_for_1 (heapvar, "PARM_NOALIAS", false);
+ rvi = create_variable_info_for_1 (heapvar, "PARM_NOALIAS", true);
rvi->is_restrict_var = 1;
insert_vi_for_tree (heapvar, rvi);
insert_restrict_pointed_var (vi, rvi);
--
1.9.1