diff options
author | Daniel Berlin <dberlin@dberlin.org> | 2007-07-07 03:25:29 +0000 |
---|---|---|
committer | Daniel Berlin <dberlin@gcc.gnu.org> | 2007-07-07 03:25:29 +0000 |
commit | e9bd9cf340129729a451df77baee39f5b2978226 (patch) | |
tree | 24aed28d0f9be6fc1f86cf8db9b21c0fc8d53291 /gcc/tree-vn.c | |
parent | 3673b8ca2b37955838b1c238ba9f70c2a30ac298 (diff) | |
download | gcc-e9bd9cf340129729a451df77baee39f5b2978226.zip gcc-e9bd9cf340129729a451df77baee39f5b2978226.tar.gz gcc-e9bd9cf340129729a451df77baee39f5b2978226.tar.bz2 |
re PR middle-end/23488 (GCSE load PRE does not work with non sets (or missing load PRE with plain decls))
2007-07-06 Daniel Berlin <dberlin@dberlin.org>
Fix PR tree-optimization/23488
* tree-ssa-sccvn.c (expr_has_constants): Handle tcc_declaration.
(try_to_simplify): Ditto.
(visit_use): Ditto.
* tree-vn.c (set_value_handle): Use decl_vh_map for decl value
handles.
* tree-flow-inline.h (get_value_handle): Ditto.
* tree-ssa-pre.c (decl_vh_map): New.
(decl_node_pool): New.
(can_value_number_operation): Support DECL_P.
(can_PRE_operation): Ditto.
(create_expression_by_pieces): Ditto.
(find_existing_value_expr): Modify to differnetiate between
addressing and top level.
(create_value_handle_for_expr): Handle DECL's.
(poolify_tree): Ditto.
(make_values_for_phi): Don't insert into PHI_GEN during FRE.
(make_values_for_stmt): Handle DECL's properly.
(init_pre): Reorg to not init useless things during FRE.
(fini_pre): Ditto.
* tree-flow.h: Include pointer-set.h.
(decl_vh_map): Declare.
* Makefile.in (TREE_FLOW_H): Add pointer-set.h
From-SVN: r126434
Diffstat (limited to 'gcc/tree-vn.c')
-rw-r--r-- | gcc/tree-vn.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-vn.c b/gcc/tree-vn.c index d62aeea..1afd0fe 100644 --- a/gcc/tree-vn.c +++ b/gcc/tree-vn.c @@ -83,6 +83,10 @@ expressions_equal_p (tree e1, tree e2) return true; } + else if (TREE_CODE (e1) == TREE_CODE (e2) + && DECL_P (e1) + && te1 == te2) + return DECL_UID (e1) == DECL_UID (e2); else if (TREE_CODE (e1) == TREE_CODE (e2) && (te1 == te2 || types_compatible_p (te1, te2)) @@ -99,7 +103,12 @@ set_value_handle (tree e, tree v) { if (TREE_CODE (e) == SSA_NAME) SSA_NAME_VALUE (e) = v; - else if (EXPR_P (e) || DECL_P (e) || TREE_CODE (e) == TREE_LIST + else if (DECL_P (e)) + { + tree *slot = (tree *)pointer_map_insert (decl_vh_map, e); + *slot = v; + } + else if (EXPR_P (e) || TREE_CODE (e) == TREE_LIST || GIMPLE_STMT_P (e) || TREE_CODE (e) == CONSTRUCTOR) get_tree_common_ann (e)->value_handle = v; |