diff options
author | Richard Guenther <rguenther@suse.de> | 2009-06-29 12:20:39 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2009-06-29 12:20:39 +0000 |
commit | 5b21f0f37dd072967e60c5e413dbabec1eb1c837 (patch) | |
tree | e708803ab158cd132fb494655ffed7aec0ca820d /gcc/gimplify.c | |
parent | 09a782ebdacc6a5227ed464d47eb3cc27e252c6a (diff) | |
download | gcc-5b21f0f37dd072967e60c5e413dbabec1eb1c837.zip gcc-5b21f0f37dd072967e60c5e413dbabec1eb1c837.tar.gz gcc-5b21f0f37dd072967e60c5e413dbabec1eb1c837.tar.bz2 |
re PR middle-end/38212 (restrict implementation causes wrong-code)
2009-06-29 Richard Guenther <rguenther@suse.de>
PR middle-end/38212
* alias.c (find_base_decl): Remove.
(get_deref_alias_set_1): Remove restrict handling.
* c-common.c (c_apply_type_quals_to_decl): Do not set
DECL_POINTER_ALIAS_SET.
* gimplify.c (find_single_pointer_decl_1): Remove.
(find_single_pointer_decl): Likewise.
(internal_get_tmp_var): Remove restrict handling.
(gimple_regimplify_operands): Likewise.
* omp-low.c (expand_omp_atomic_pipeline): Do not set
DECL_POINTER_ALIAS_SET. Use ref-all pointers.
* print-tree.c (print_node): Do not print DECL_POINTER_ALIAS_SET.
* tree.c (restrict_base_for_decl): Remove.
(init_ttree): Do not allocate it.
(make_node_stat): Do not set DECL_POINTER_ALIAS_SET. Set
LABEL_DECL_UID for label decls.
(copy_node_stat): Do not copy restrict information.
(decl_restrict_base_lookup): Remove.
(decl_restrict_base_insert): Likewise.
(print_restrict_base_statistics): Likewise.
(dump_tree_statistics): Do not call print_restrict_base_statistics.
* tree.h (DECL_POINTER_ALIAS_SET): Remove.
(DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise.
(struct tree_decl_common): Rename pointer_alias_set to label_decl_uid.
(LABEL_DECL_UID): Adjust.
(DECL_BASED_ON_RESTRICT_P): Remove.
(DECL_GET_RESTRICT_BASE): Likewise.
(SET_DECL_RESTRICT_BASE): Likewise.
(struct tree_decl_with_vis): Remove based_on_restrict_p flag.
* config/i386/i386.c (ix86_gimplify_va_arg): Use ref-all pointers
instead of DECL_POINTER_ALIAS_SET.
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise.
* config/s390/s390.c (s390_gimplify_va_arg): Likewise.
* config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise.
* gcc.c-torture/execute/pr38212.c: New testcase.
From-SVN: r149047
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 83 |
1 files changed, 4 insertions, 79 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 15005c3..33e5a2e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -430,57 +430,6 @@ remove_suffix (char *name, int len) } } -/* Subroutine for find_single_pointer_decl. */ - -static tree -find_single_pointer_decl_1 (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, - void *data) -{ - tree *pdecl = (tree *) data; - - /* We are only looking for pointers at the same level as the - original tree; we must not look through any indirections. - Returning anything other than NULL_TREE will cause the caller to - not find a base. */ - if (REFERENCE_CLASS_P (*tp)) - return *tp; - - if (DECL_P (*tp) && POINTER_TYPE_P (TREE_TYPE (*tp))) - { - if (*pdecl) - { - /* We already found a pointer decl; return anything other - than NULL_TREE to unwind from walk_tree signalling that - we have a duplicate. */ - return *tp; - } - *pdecl = *tp; - } - - return NULL_TREE; -} - -/* Find the single DECL of pointer type in the tree T, used directly - rather than via an indirection, and return it. If there are zero - or more than one such DECLs, return NULL. */ - -static tree -find_single_pointer_decl (tree t) -{ - tree decl = NULL_TREE; - - if (walk_tree (&t, find_single_pointer_decl_1, &decl, NULL)) - { - /* find_single_pointer_decl_1 returns a nonzero value, causing - walk_tree to return a nonzero value, to indicate that it - found more than one pointer DECL or that it found an - indirection. */ - return NULL_TREE; - } - - return decl; -} - /* Create a new temporary name with PREFIX. Returns an identifier. */ static GTY(()) unsigned int tmp_var_id_num; @@ -653,27 +602,10 @@ internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p, t = lookup_tmp_var (val, is_formal); - if (is_formal) - { - tree u = find_single_pointer_decl (val); - - if (u && TREE_CODE (u) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (u)) - u = DECL_GET_RESTRICT_BASE (u); - if (u && TYPE_RESTRICT (TREE_TYPE (u))) - { - if (DECL_BASED_ON_RESTRICT_P (t)) - gcc_assert (u == DECL_GET_RESTRICT_BASE (t)); - else - { - DECL_BASED_ON_RESTRICT_P (t) = 1; - SET_DECL_RESTRICT_BASE (t, u); - } - } - - if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (t) = 1; - } + if (is_formal + && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)) + DECL_GIMPLE_REG_P (t) = 1; mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val)); @@ -7766,13 +7698,6 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) DECL_GIMPLE_REG_P (temp) = 1; if (TREE_CODE (orig_lhs) == SSA_NAME) orig_lhs = SSA_NAME_VAR (orig_lhs); - if (TREE_CODE (orig_lhs) == VAR_DECL - && DECL_BASED_ON_RESTRICT_P (orig_lhs)) - { - DECL_BASED_ON_RESTRICT_P (temp) = 1; - SET_DECL_RESTRICT_BASE (temp, - DECL_GET_RESTRICT_BASE (orig_lhs)); - } if (gimple_in_ssa_p (cfun)) temp = make_ssa_name (temp, NULL); |